diff --git a/main.c b/main.c index 784d0ed..3f19333 100644 --- a/main.c +++ b/main.c @@ -164,6 +164,25 @@ void Main(void) { #endif BootMode = BOOT_GetMode(); + + // wait for user to release all butts before moving on + if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || + KEYBOARD_Poll() != KEY_INVALID || + BootMode != BOOT_MODE_NORMAL) + { // keys are pressed + UI_DisplayReleaseKeys(); + BACKLIGHT_TurnOn(); + i = 0; + while (i < 50) // 500ms + { + i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0; + SYSTEM_DelayMs(10); + } + gKeyReading0 = KEY_INVALID; + gKeyReading1 = KEY_INVALID; + gDebounceCounter = 0; + } + if (gEeprom.POWER_ON_PASSWORD < 1000000) { bIsInLockScreen = true; UI_DisplayLock(); diff --git a/ui/welcome.c b/ui/welcome.c index 243dab0..ead6293 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -24,6 +24,18 @@ #include "../version.h" #include +void UI_DisplayReleaseKeys(void) +{ + memset(gStatusLine, 0, sizeof(gStatusLine)); + memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); + + UI_PrintString("RELEASE", 0, 127, 1, 10, true); + UI_PrintString("ALL KEYS", 0, 127, 3, 10, true); + + ST7565_BlitStatusLine(); // blank status line + ST7565_BlitFullScreen(); +} + void UI_DisplayWelcome(void) { memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); diff --git a/ui/welcome.h b/ui/welcome.h index 3ef4e3f..79fccd2 100644 --- a/ui/welcome.h +++ b/ui/welcome.h @@ -22,6 +22,7 @@ void UI_DisplayInfo(void); void UI_DisplayVersion(void); void UI_DisplayVersionFM(void); void UI_Matoz(void); +void UI_DisplayReleaseKeys(void); #endif