Add RESTORE_SCAN feature

This commit is contained in:
Armel FAUVEAU
2024-10-28 02:03:52 +01:00
parent c94ea17943
commit 08cce22968
7 changed files with 108 additions and 3 deletions

View File

@@ -220,6 +220,9 @@ void ACTION_Scan(bool bRestart)
// channel mode. Keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6;
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
SETTINGS_WriteCurrentState();
#endif
// jump to the next channel
CHFRSCANNER_Start(false, gScanStateDir);

View File

@@ -196,6 +196,11 @@ void CHFRSCANNER_Stop(void)
}
}
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
gEeprom.CURRENT_STATE = 0;
SETTINGS_WriteCurrentState();
#endif
RADIO_SetupRegisters(true);
gUpdateDisplay = true;
}

View File

@@ -407,6 +407,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
switch(Key) {
case KEY_0...KEY_5:
gEeprom.SCAN_LIST_DEFAULT = Key;
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
SETTINGS_WriteCurrentState();
#endif
break;
default:
break;
@@ -684,6 +687,17 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
if (!bKeyPressed) // released
return;
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
if(gScanRangeStart == 0) // No ScanRange
{
gEeprom.CURRENT_STATE = 1;
}
else // ScanRange
{
gEeprom.CURRENT_STATE = 2;
}
SETTINGS_WriteCurrentState();
#endif
ACTION_Scan(false);// toggle scanning
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
@@ -732,6 +746,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
// scan the CTCSS/DCS code
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
SCANNER_Start(true);
gRequestDisplayScreen = DISPLAY_SCANNER;
}