diff --git a/app/action.c b/app/action.c index 79f5805..1ea03e0 100644 --- a/app/action.c +++ b/app/action.c @@ -160,7 +160,8 @@ void ACTION_Scan(bool bRestart) #endif if (gScreenToDisplay != DISPLAY_SCANNER) - { + { // not scanning + RADIO_SelectVfos(); #ifdef ENABLE_NOAA @@ -192,6 +193,18 @@ void ACTION_Scan(bool bRestart) } } } + else + if (!bRestart) + { // scanning + + SCANNER_Stop(); + + #ifdef ENABLE_VOICE + gAnotherVoiceID = VOICE_ID_SCANNING_STOP; + #endif + + gRequestDisplayScreen = DISPLAY_MAIN; + } } void ACTION_Vox(void) diff --git a/app/app.c b/app/app.c index 90301cd..3cc4c93 100644 --- a/app/app.c +++ b/app/app.c @@ -2068,7 +2068,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) const bool backlight_was_on = GPIO_CheckBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); if (Key == KEY_EXIT && !backlight_was_on && gEeprom.BACKLIGHT > 0) - { // just turn the light on for now + { // just turn the light on for now so the user can see what's what BACKLIGHT_TurnOn(); gBeepToPlay = BEEP_NONE; return; @@ -2172,11 +2172,13 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } if (gScanState != SCAN_OFF && - Key != KEY_PTT && - Key != KEY_UP && - Key != KEY_DOWN && - Key != KEY_EXIT && - Key != KEY_STAR) + Key != KEY_PTT && + Key != KEY_UP && + Key != KEY_DOWN && + Key != KEY_EXIT && + Key != KEY_SIDE1 && + Key != KEY_SIDE2 && + Key != KEY_STAR) { // scanning if (bKeyPressed && !bKeyHeld) AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); @@ -2184,12 +2186,14 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } if (gCssScanMode != CSS_SCAN_MODE_OFF && - Key != KEY_PTT && - Key != KEY_UP && - Key != KEY_DOWN && - Key != KEY_EXIT && - Key != KEY_STAR && - Key != KEY_MENU) + Key != KEY_PTT && + Key != KEY_UP && + Key != KEY_DOWN && + Key != KEY_EXIT && + Key != KEY_SIDE1 && + Key != KEY_SIDE2 && + Key != KEY_STAR && + Key != KEY_MENU) { // code scanning if (bKeyPressed && !bKeyHeld) AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); @@ -2224,7 +2228,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gUpdateStatus = true; } - if (gF_LOCK && (Key == KEY_PTT || Key == KEY_SIDE2 || Key == KEY_SIDE1)) +// if (gF_LOCK && (Key == KEY_PTT || Key == KEY_SIDE2 || Key == KEY_SIDE1)) + if (gF_LOCK && Key == KEY_PTT) return; if (!bFlag) diff --git a/app/menu.c b/app/menu.c index c6f1f48..ffed25c 100644 --- a/app/menu.c +++ b/app/menu.c @@ -1314,9 +1314,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) if (edit_index < 0) { // enter channel name edit mode if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0)) - { return; - } BOARD_fetchChannelName(edit, gSubMenuSelection); @@ -1326,6 +1324,9 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) edit[edit_index++] = '_'; edit[edit_index] = 0; edit_index = 0; // 'edit_index' is going to be used as the cursor position + + // make a copy so we can test for change when exiting the menu item + memmove(edit_original, edit, sizeof(edit_original)); return; } @@ -1337,57 +1338,74 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) return; // next char // exit - gFlagAcceptSetting = false; - gAskForConfirmation = 0; + if (memcmp(edit_original, edit, sizeof(edit_original)) == 0) + { // no change + gFlagAcceptSetting = false; + gIsInSubMenu = false; + gAskForConfirmation = 0; + } + else + { + gFlagAcceptSetting = false; + gAskForConfirmation = 0; + } + } + } + + // exiting the sub menu + + if (gIsInSubMenu) + { + if (gMenuCursor == MENU_RESET || + gMenuCursor == MENU_MEM_CH || + gMenuCursor == MENU_DEL_CH || + gMenuCursor == MENU_MEM_NAME) + { + switch (gAskForConfirmation) + { + case 0: + gAskForConfirmation = 1; + break; + + case 1: + gAskForConfirmation = 2; + + UI_DisplayMenu(); + + if (gMenuCursor == MENU_RESET) + { + #ifdef ENABLE_VOICE + AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM); + AUDIO_PlaySingleVoice(true); + #endif + + MENU_AcceptSetting(); + + #if defined(ENABLE_OVERLAY) + overlay_FLASH_RebootToBootloader(); + #else + NVIC_SystemReset(); + #endif + } + + gFlagAcceptSetting = true; + gIsInSubMenu = false; + gAskForConfirmation = 0; + } + } + else + { + gFlagAcceptSetting = true; + gIsInSubMenu = false; } } - if (gMenuCursor == MENU_RESET || - gMenuCursor == MENU_MEM_CH || - gMenuCursor == MENU_DEL_CH || - gMenuCursor == MENU_MEM_NAME) + if (gCssScanMode != CSS_SCAN_MODE_OFF) { - switch (gAskForConfirmation) - { - case 0: - gAskForConfirmation = 1; - break; - - case 1: - gAskForConfirmation = 2; - - UI_DisplayMenu(); - - if (gMenuCursor == MENU_RESET) - { - #ifdef ENABLE_VOICE - AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM); - AUDIO_PlaySingleVoice(true); - #endif - - MENU_AcceptSetting(); - - #if defined(ENABLE_OVERLAY) - overlay_FLASH_RebootToBootloader(); - #else - NVIC_SystemReset(); - #endif - } - - gFlagAcceptSetting = true; - gIsInSubMenu = false; - gAskForConfirmation = 0; - } + gCssScanMode = CSS_SCAN_MODE_OFF; + gUpdateStatus = true; } - else - { - gFlagAcceptSetting = true; - gIsInSubMenu = false; - } - - gCssScanMode = CSS_SCAN_MODE_OFF; - gUpdateStatus = true; - + #ifdef ENABLE_VOICE if (gMenuCursor == MENU_SCR) gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON; diff --git a/firmware b/firmware index e0b276a..93a7f02 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index 1d492a0..8b2964b 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 17d0cd9..6298491 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/ui/menu.c b/ui/menu.c index 1345559..629295b 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -275,6 +275,7 @@ int8_t gMenuScrollDirection; int32_t gSubMenuSelection; // edit box +char edit_original[17]; // a copy of the text before editing char edit[17]; int edit_index; @@ -493,8 +494,8 @@ void UI_DisplayMenu(void) { // show the channel name being edited UI_PrintString(edit, 50, 0, 2, 8); if (edit_index < 10) -// UI_PrintString("^", 50 + (8 * edit_index), 0, 4, 8); // show the cursor - UI_PrintStringSmall("^", 50 + (8 * edit_index), 0, 4); + UI_PrintString("^", 50 + (8 * edit_index), 0, 4, 8); // show the cursor +// UI_PrintStringSmall("^", 50 + (8 * edit_index), 0, 4); } if (!gAskForConfirmation) diff --git a/ui/menu.h b/ui/menu.h index a0ae914..61b2f34 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -133,6 +133,7 @@ extern uint8_t gMenuCursor; extern int8_t gMenuScrollDirection; extern int32_t gSubMenuSelection; +extern char edit_original[17]; extern char edit[17]; extern int edit_index;