This commit is contained in:
2025-08-20 21:56:55 -05:00
parent 84f2735246
commit 3a753b1299
10 changed files with 220 additions and 97 deletions

View File

@@ -28,8 +28,6 @@ void consoleInit() {
consolePrint(" = Dawn Console = ");
#if DUSK_CONSOLE_POSIX
threadInit(&CONSOLE.thread, consoleInputThread);
threadMutexInit(&CONSOLE.execMutex);
threadStartRequest(&CONSOLE.thread);
@@ -77,7 +75,9 @@ void consolePrint(const char_t *message, ...) {
}
void consoleExec(const char_t *line) {
threadMutexLock(&CONSOLE.execMutex);
#if DUSK_CONSOLE_POSIX
threadMutexLock(&CONSOLE.execMutex);
#endif
assertNotNull(line, "line must not be NULL");
assertTrue(
@@ -279,59 +279,28 @@ void consoleExec(const char_t *line) {
}
}
threadMutexUnlock(&CONSOLE.execMutex);
#if DUSK_CONSOLE_POSIX
threadMutexUnlock(&CONSOLE.execMutex);
#endif
}
// May move these later
void consoleUpdate() {
#if DUSK_CONSOLE_POSIX
threadMutexLock(&CONSOLE.execMutex);
#endif
threadMutexLock(&CONSOLE.execMutex);
for(uint32_t i = 0; i < CONSOLE.execBufferCount; i++) {
consolecmdexec_t *exec = &CONSOLE.execBuffer[i];
assertNotNull(exec->cmd, "Command execution has no command.");
exec->cmd->function(exec);
}
threadMutexUnlock(&CONSOLE.execMutex);
// #if DUSK_KEYBOARD_SUPPORT == 1
// uint8_t key;
// while((key = inputKeyboardPop()) != 0) {
// printf("Key pressed: %c\n", key);
// switch(key) {
// case 0:
// break;
// case INPUT_KEY_ENTER:
// consoleExec(CONSOLE.inputBuffer);
// CONSOLE.inputIndex = 0;
// CONSOLE.inputBuffer[0] = '\0';
// break;
// case INPUT_KEY_BACKSPACE:
// if(CONSOLE.inputIndex > 0) {
// CONSOLE.inputIndex--;
// CONSOLE.inputBuffer[CONSOLE.inputIndex] = '\0';
// }
// break;
// default:
// if(
// key >= INPUT_KEY_ASCII_START && key <= INPUT_KEY_ASCII_END &&
// CONSOLE.inputIndex < CONSOLE_LINE_MAX - 1
// ) {
// CONSOLE.inputBuffer[CONSOLE.inputIndex++] = key;
// CONSOLE.inputBuffer[CONSOLE.inputIndex] = '\0';
// }
// break;
// }
// }
// #endif
// Clear the exec buffer
CONSOLE.execBufferCount = 0;
#if DUSK_CONSOLE_POSIX
threadMutexUnlock(&CONSOLE.execMutex);
#endif
}
void consoleDispose(void) {
@@ -343,7 +312,6 @@ void consoleDispose(void) {
consolePrint(" = Console shutting down = ");
}
#if DUSK_CONSOLE_POSIX
void consoleInputThread(thread_t *thread) {
assertNotNull(thread, "Thread cannot be NULL.");