Skip to content

Commit

Permalink
Bugfix: Emulator power cycled on boot with no other keys pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
shezik committed Jul 16, 2023
1 parent 6678fd9 commit 105e71f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ void setup() {
nutEmuInterface.resume();

uint16_t keycode;
xSemaphoreTake(keyboardMgr.getMutex(), 0);
xSemaphoreTake(keyboardMgr.getMutex(), portMAX_DELAY);
for (;;) {
keycode = GetKeycodeContent(keyboardMgr.getPositiveKeycode());
if (keycode == 24 /*ON*/)
keycode = keyboardMgr.getPositiveKeycode();
if (GetKeycodeContent(keycode) == 24 /*ON*/)
continue;
break;
}
xSemaphoreGive(keyboardMgr.getMutex());
printf_log("Keycode on startup: %d\n", keycode);
if (keycode != INVALID_KEYCODE) {
nutEmuInterface.handleONKeySequence(keycode);
nutEmuInterface.handleONKeySequence(GetKeycodeContent(keycode));
}
}
menu.init(!isRestoreFlagPresent); // Load user settings into classes, skip showing main menu if restore file is successfully loaded
Expand Down

0 comments on commit 105e71f

Please sign in to comment.