From ab6c7b841572e869bf453ed5d584b1b3c93c9fa5 Mon Sep 17 00:00:00 2001 From: xawen Date: Sat, 27 Apr 2024 12:47:30 -0400 Subject: [PATCH] Scan Delay Menu Option --- app/menu.c | 17 +++++++++++++++++ app/menu.h | 1 + radio/settings.c | 3 +++ radio/settings.h | 2 +- task/keyaction.c | 2 +- task/scanner.c | 2 +- 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/menu.c b/app/menu.c index 78430f9..13966dd 100644 --- a/app/menu.c +++ b/app/menu.c @@ -65,6 +65,7 @@ static const char Menu[][14] = { "VOX Delay ", "RX Save Mode ", "Scan Direction", + "Scan Delay ", "Scan Resume ", "Scan Blink ", "Squelch Mode ", @@ -477,6 +478,11 @@ void MENU_AcceptSetting(void) SETTINGS_SaveGlobals(); break; + case MENU_SCAN_DELAY: + gExtendedSettings.ScanDelay = (gSettingCurrentValue + gSettingIndex) % gSettingMaxValues; + SETTINGS_SaveGlobals(); + break; + case MENU_SCAN_RESUME: gExtendedSettings.ScanResume = ((gSettingCurrentValue + gSettingIndex) % gSettingMaxValues) + 1; SETTINGS_SaveGlobals(); @@ -889,6 +895,13 @@ void MENU_DrawSetting(void) UI_DrawSettingRepeaterMode(gSettingCurrentValue); break; + case MENU_SCAN_DELAY: + gSettingCurrentValue = gExtendedSettings.ScanDelay; + gSettingMaxValues = 62; + DISPLAY_Fill(0, 159, 1, 55, COLOR_BACKGROUND); + UI_DrawSettingNumList(gSettingCurrentValue, gSettingMaxValues); + break; + case MENU_SCAN_RESUME: gSettingCurrentValue = gExtendedSettings.ScanResume - 1; gSettingMaxValues = 3; @@ -1328,6 +1341,10 @@ void MENU_ScrollSetting(uint8_t Key) UI_DrawSettingRepeaterMode(gSettingCurrentValue); break; + case MENU_SCAN_DELAY: + UI_DrawSettingNumList(gSettingCurrentValue, 62); + break; + case MENU_SCAN_RESUME: UI_DrawSettingScanResume(gSettingCurrentValue); break; diff --git a/app/menu.h b/app/menu.h index cf71031..2934d47 100644 --- a/app/menu.h +++ b/app/menu.h @@ -47,6 +47,7 @@ enum { MENU_VOX_DELAY, MENU_SAVE_MODE, MENU_SCAN_DIR, + MENU_SCAN_DELAY, MENU_SCAN_RESUME, MENU_SCAN_BLINK, MENU_SQUELCH_MODE, diff --git a/radio/settings.c b/radio/settings.c index 2132582..06ace85 100644 --- a/radio/settings.c +++ b/radio/settings.c @@ -117,6 +117,9 @@ void SETTINGS_LoadSettings(void) gExtendedSettings.SqNoiseBase = 0x44; gExtendedSettings.SqGlitchBase = 0x11; } + if (gExtendedSettings.ScanDelay == 63) { + gExtendedSettings.ScanDelay = 35; + } gFrequencyStep = FREQUENCY_GetStep(gSettings.FrequencyStep); diff --git a/radio/settings.h b/radio/settings.h index 2671aeb..b673ed5 100644 --- a/radio/settings.h +++ b/radio/settings.h @@ -179,7 +179,7 @@ typedef struct __attribute__((packed)) { uint8_t SqGlitchBase; //0x14 uint8_t SqMode: 2; - uint8_t Undefined2: 6; // free for use + uint8_t ScanDelay: 6; //0x15... } gExtendedSettings_t; diff --git a/task/keyaction.c b/task/keyaction.c index 84899af..6afc123 100644 --- a/task/keyaction.c +++ b/task/keyaction.c @@ -236,7 +236,7 @@ void KeypressAction(uint8_t Action) { gManualScanDirection = gSettings.ScanDirection; gScannerMode ^= 1; bBeep740 = gScannerMode; - SCANNER_Countdown = 15; + SCANNER_Countdown = gExtendedSettings.ScanDelay; UI_DrawScan(); break; diff --git a/task/scanner.c b/task/scanner.c index 2132f10..7a15631 100644 --- a/task/scanner.c +++ b/task/scanner.c @@ -57,7 +57,7 @@ void Task_Scanner(void) { #ifdef ENABLE_FM_RADIO gFM_Mode > FM_MODE_OFF ? 50 : #endif - 15; + gExtendedSettings.ScanDelay; if (gExtendedSettings.ScanBlink) { gpio_bits_flip(GPIOA, BOARD_GPIOA_LED_GREEN); }