From 6172d942be2dc333e80c4afc97e87e1829cbff2b Mon Sep 17 00:00:00 2001 From: Krzysiek Egzmont Date: Tue, 17 Oct 2023 02:57:55 +0200 Subject: [PATCH] Fix scanning on opposite VFO, ignore scan result on EXIT button, changed status bar while scanning --- app/main.c | 1 + app/scanner.c | 11 +++++++++++ ui/status.c | 26 ++++++++++++++------------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/app/main.c b/app/main.c index c848269..67a830f 100644 --- a/app/main.c +++ b/app/main.c @@ -506,6 +506,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) } else { + bScanKeepFrequency = false; SCANNER_Stop(); #ifdef ENABLE_VOICE diff --git a/app/scanner.c b/app/scanner.c index a5d24c4..d717557 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -45,6 +45,7 @@ bool gScanUseCssResult; int8_t gScanStateDir; bool bScanKeepFrequency; uint8_t gRestoreMrChannel; +uint8_t gRestoreCROSS_BAND_RX_TX; static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { @@ -426,6 +427,11 @@ void SCANNER_Start(void) void SCANNER_Stop(void) { + if(gRestoreCROSS_BAND_RX_TX != CROSS_BAND_OFF) { + gEeprom.CROSS_BAND_RX_TX = gRestoreCROSS_BAND_RX_TX; + gRestoreCROSS_BAND_RX_TX = CROSS_BAND_OFF; + } + gScanStateDir = SCAN_OFF; if (!bScanKeepFrequency) @@ -580,6 +586,11 @@ static void SCANNER_NextMemChannel(void) void SCANNER_NextChannel(const bool storeBackupSettings, const int8_t scan_direction) { + if (storeBackupSettings) { + gRestoreCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; + gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; + } + RADIO_SelectVfos(); gNextMrChannel = gRxVfo->CHANNEL_SAVE; diff --git a/ui/status.c b/ui/status.c index 2a5c8f7..b5e7864 100644 --- a/ui/status.c +++ b/ui/status.c @@ -88,7 +88,7 @@ void UI_DisplayStatus(const bool test_display) // SCAN indicator if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display) { - if (gNextMrChannel <= MR_CHANNEL_LAST) + if (gNextMrChannel <= MR_CHANNEL_LAST && gScreenToDisplay != DISPLAY_SCANNER) { // channel mode if (gEeprom.SCAN_LIST_DEFAULT == 0) UI_PrintStringSmallBuffer("1", line + x); @@ -114,22 +114,24 @@ void UI_DisplayStatus(const bool test_display) memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); x1 = x + sizeof(BITMAP_VoicePrompt); } - x += sizeof(BITMAP_VoicePrompt) + 2; + x += sizeof(BITMAP_VoicePrompt) + 1; #else // hmmm, what to put in it's place #endif - uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; - if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond - if(gDualWatchActive || test_display) - memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5)); - else - memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2)); + x++; + if(gScreenToDisplay != DISPLAY_SCANNER) { + uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; + if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond + if(gDualWatchActive || test_display) + memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5)); + else + memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2)); + } + else if(dw == 2) { // XB - crossband + memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB)); + } } - else if(dw == 2) { // XB - crossband - memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB)); - } - x += sizeof(BITMAP_TDR1) + 2; #ifdef ENABLE_VOX