Add scan mode menu

This commit is contained in:
Armel FAUVEAU committed 2026-05-04 04:56:15 +02:00
1 parent 932d6e954a
commit c1d5b7bd55
8 files changed
+92 -19

No files matched your search

+30 -15
View File
@@ -63,6 +63,13 @@ static void NextMemChannel(void);
static void ScanFastResetState(void); static void ScanFastResetState(void);
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
static bool ScanFastEnabled(void)
{
return gSetting_set_scn;
}
#endif
#ifdef ENABLE_SCAN_RANGES #ifdef ENABLE_SCAN_RANGES
static void ScanRangeSkipClear(void) static void ScanRangeSkipClear(void)
{ {
@@ -273,7 +280,7 @@ static void ScanFastTune(uint32_t frequency)
const VFO_Info_t *CHFRSCANNER_GetScanDisplayVfo(void) const VFO_Info_t *CHFRSCANNER_GetScanDisplayVfo(void)
{ {
if (!scanFastDisplayVfoValid || gScanStateDir == SCAN_OFF || FUNCTION_IsRx()) if (!ScanFastEnabled() || !scanFastDisplayVfoValid || gScanStateDir == SCAN_OFF || FUNCTION_IsRx())
return NULL; return NULL;
return &scanFastDisplayVfo; return &scanFastDisplayVfo;
@@ -850,24 +857,32 @@ static void NextFreqChannel(void)
#ifdef ENABLE_SCAN_RANGES #ifdef ENABLE_SCAN_RANGES
if(gScanRangeStart) { if(gScanRangeStart) {
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER #ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
const scan_fast_result_t fastResult = ScanRangeFastPrecheck(); if (ScanFastEnabled())
if (fastResult == SCAN_FAST_QUIET_BATCH)
{ {
scanFastLastFullTuneCandidate = false; const scan_fast_result_t fastResult = ScanRangeFastPrecheck();
gScanPauseDelayIn_10ms = 1;
gUpdateDisplay = true;
return;
}
if (fastResult == SCAN_FAST_DISABLED) if (fastResult == SCAN_FAST_QUIET_BATCH)
{ {
scanFastLastFullTuneCandidate = false; scanFastLastFullTuneCandidate = false;
gRxVfo->freq_config_RX.Frequency = ScanRangeNextFrequency(); gScanPauseDelayIn_10ms = 1;
gUpdateDisplay = true;
return;
}
if (fastResult == SCAN_FAST_DISABLED)
{
scanFastLastFullTuneCandidate = false;
gRxVfo->freq_config_RX.Frequency = ScanRangeNextFrequency();
}
else
{
scanFastLastFullTuneCandidate = true;
}
} }
else else
{ {
scanFastLastFullTuneCandidate = true; scanFastLastFullTuneCandidate = false;
gRxVfo->freq_config_RX.Frequency = ScanRangeNextFrequency();
} }
#else #else
gRxVfo->freq_config_RX.Frequency = ScanRangeNextFrequency(); gRxVfo->freq_config_RX.Frequency = ScanRangeNextFrequency();
@@ -1014,7 +1029,7 @@ static void NextMemChannel(void)
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER #ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
SetMemScanProgressChannel(gNextMrChannel); SetMemScanProgressChannel(gNextMrChannel);
if (!MemChannelFastPrecheck(gNextMrChannel)) if (ScanFastEnabled() && !MemChannelFastPrecheck(gNextMrChannel))
{ {
gScanPauseDelayIn_10ms = 1; gScanPauseDelayIn_10ms = 1;
gUpdateDisplay = true; gUpdateDisplay = true;
+16
View File
@@ -426,6 +426,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1; *pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1;
break; break;
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
case MENU_SET_SCN:
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_SCN) - 1;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_AUDIO #ifdef ENABLE_FEAT_F4HWN_AUDIO
case MENU_SET_AUD: case MENU_SET_AUD:
//*pMin = 0; //*pMin = 0;
@@ -989,6 +995,11 @@ void MENU_AcceptSetting(void)
case MENU_SET_GUI: case MENU_SET_GUI:
gSetting_set_gui = gSubMenuSelection; gSetting_set_gui = gSubMenuSelection;
break; break;
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
case MENU_SET_SCN:
gSetting_set_scn = gSubMenuSelection;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_AUDIO #ifdef ENABLE_FEAT_F4HWN_AUDIO
case MENU_SET_AUD: case MENU_SET_AUD:
if(gTxVfo->Modulation == MODULATION_AM) if(gTxVfo->Modulation == MODULATION_AM)
@@ -1453,6 +1464,11 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_GUI: case MENU_SET_GUI:
gSubMenuSelection = gSetting_set_gui; gSubMenuSelection = gSetting_set_gui;
break; break;
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
case MENU_SET_SCN:
gSubMenuSelection = gSetting_set_scn;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_AUDIO #ifdef ENABLE_FEAT_F4HWN_AUDIO
case MENU_SET_AUD: case MENU_SET_AUD:
if(gTxVfo->Modulation == MODULATION_AM) if(gTxVfo->Modulation == MODULATION_AM)
+5 -1
View File
@@ -116,6 +116,10 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
bool gWakeUp = false; bool gWakeUp = false;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
bool gSetting_set_scn = 1;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
uint8_t gSetting_set_pwr = 1; uint8_t gSetting_set_pwr = 1;
bool gSetting_set_ptt = 0; bool gSetting_set_ptt = 0;
@@ -649,4 +653,4 @@ void MR_PrintCacheStats(void)
return false; return false;
} }
#endif #endif
+4
View File
@@ -176,6 +176,10 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern bool gWakeUp; extern bool gWakeUp;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
extern bool gSetting_set_scn;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
extern uint8_t gSetting_set_pwr; extern uint8_t gSetting_set_pwr;
extern bool gSetting_set_ptt; extern bool gSetting_set_ptt;
+2 -1
View File
@@ -110,7 +110,8 @@ void SysTick_Handler(void)
#define SCAN_FAST_STALL_WATCHDOG_10ms 25 // 250 ms #define SCAN_FAST_STALL_WATCHDOG_10ms 25 // 250 ms
static uint16_t scanFastStallCounter; static uint16_t scanFastStallCounter;
if (gScanStateDir != SCAN_OFF if (gSetting_set_scn
&& gScanStateDir != SCAN_OFF
&& gScanPauseDelayIn_10ms == 0 && gScanPauseDelayIn_10ms == 0
&& !gScheduleScanListen && !gScheduleScanListen
&& !g_SquelchLost && !g_SquelchLost
+12 -2
View File
@@ -454,8 +454,12 @@ gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data16[5]) ? Data16[5] : (FREQ_CHANNE
// 1FF0..0x1FF7 // 1FF0..0x1FF7
// TODO: address TBD // TODO: address TBD
PY25Q16_ReadBuffer(0x00A158, Data, 8); PY25Q16_ReadBuffer(0x00A158, Data, 8);
const uint8_t set_ptt_scn = Data[7] & 0x0F;
gSetting_set_pwr = (((Data[7] & 0xF0) >> 4) < 7) ? ((Data[7] & 0xF0) >> 4) : 0; gSetting_set_pwr = (((Data[7] & 0xF0) >> 4) < 7) ? ((Data[7] & 0xF0) >> 4) : 0;
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0; gSetting_set_ptt = (set_ptt_scn < 4) ? (set_ptt_scn & 0x01) : 0;
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
gSetting_set_scn = (set_ptt_scn < 4) ? ((set_ptt_scn & 0x02) == 0) : 1;
#endif
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0; gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0; gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0;
@@ -1127,7 +1131,13 @@ void SETTINGS_SaveSettings(void)
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F)); State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F)); State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
State[7] = ((gSetting_set_pwr << 4) | (gSetting_set_ptt & 0x0F)); uint8_t set_ptt_scn = gSetting_set_ptt & 0x01;
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
if (!gSetting_set_scn)
set_ptt_scn |= 0x02;
#endif
State[7] = ((gSetting_set_pwr << 4) | set_ptt_scn);
gEeprom.KEY_LOCK_PTT = gSetting_set_lck; gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
+17
View File
@@ -168,6 +168,9 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
{"SetNWR", MENU_NOAA_S }, {"SetNWR", MENU_NOAA_S },
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
{"SetScn", MENU_SET_SCN },
#endif
#endif #endif
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
@@ -414,6 +417,14 @@ const char gSubMenu_SCRAMBLER[][7] =
"CLASSIC" "CLASSIC"
}; };
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
const char gSubMenu_SET_SCN[][7] =
{
"NORMAL",
"FAST"
};
#endif
#ifdef ENABLE_FEAT_F4HWN_AUDIO #ifdef ENABLE_FEAT_F4HWN_AUDIO
const char gSubMenu_SET_AUD_FM[][6] = const char gSubMenu_SET_AUD_FM[][6] =
{ {
@@ -1350,6 +1361,12 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET
break; break;
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
case MENU_SET_SCN:
strcpy(String, gSubMenu_SET_SCN[gSubMenuSelection]);
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_AUDIO #ifdef ENABLE_FEAT_F4HWN_AUDIO
case MENU_SET_AUD: case MENU_SET_AUD:
if(gTxVfo->Modulation == MODULATION_AM) { if(gTxVfo->Modulation == MODULATION_AM) {
+6
View File
@@ -137,6 +137,9 @@ enum
MENU_SET_MET, MENU_SET_MET,
MENU_SET_GUI, MENU_SET_GUI,
MENU_SET_TMR, MENU_SET_TMR,
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
MENU_SET_SCN,
#endif
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
MENU_SET_NFM, MENU_SET_NFM,
#endif #endif
@@ -191,6 +194,9 @@ extern const char gSubMenu_D_RSP[4][11];
extern const char gSubMenu_SET_TOT[4][7]; extern const char gSubMenu_SET_TOT[4][7];
extern const char gSubMenu_SET_LCK[2][9]; extern const char gSubMenu_SET_LCK[2][9];
extern const char gSubMenu_SET_MET[2][8]; extern const char gSubMenu_SET_MET[2][8];
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
extern const char gSubMenu_SET_SCN[2][7];
#endif
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
extern const char gSubMenu_SET_NFM[2][9]; extern const char gSubMenu_SET_NFM[2][9];
#endif #endif