Skip to content

Commit

Permalink
Scan Delay Menu Option
Browse files Browse the repository at this point in the history
  • Loading branch information
xawen committed Apr 27, 2024
1 parent d4560ec commit ab6c7b8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
17 changes: 17 additions & 0 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ static const char Menu[][14] = {
"VOX Delay ",
"RX Save Mode ",
"Scan Direction",
"Scan Delay ",
"Scan Resume ",
"Scan Blink ",
"Squelch Mode ",
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions app/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions radio/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion radio/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion task/keyaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion task/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit ab6c7b8

Please sign in to comment.