diff --git a/App/app/action.c b/App/app/action.c index df33e903..f441940d 100644 --- a/App/app/action.c +++ b/App/app/action.c @@ -243,9 +243,7 @@ void ACTION_Scan(bool bRestart) #endif // jump to the next channel - CHFRSCANNER_Start(false, gScanStateDir); - gScanPauseDelayIn_10ms = 1; - gScheduleScanListen = false; + CHFRSCANNER_ManualResume(gScanStateDir); } else { #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE if(gScanRangeStart == 0) // No ScanRange diff --git a/App/app/chFrScanner.c b/App/app/chFrScanner.c index cc9204a0..7efd2c9b 100644 --- a/App/app/chFrScanner.c +++ b/App/app/chFrScanner.c @@ -349,6 +349,26 @@ void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_directi gScanPauseMode = false; } +void CHFRSCANNER_ManualResume(const int8_t scan_direction) +{ + if (FUNCTION_IsRx()) + { + // Abort the current reception before a user-forced scan step, otherwise + // HandleReceive() can re-apply the carrier resume delay on the next tick. + gMonitor = false; + gRxReceptionMode = RX_MODE_NONE; + gScanPauseMode = false; + + FUNCTION_Init(); + FUNCTION_Select(FUNCTION_FOREGROUND); + } + + CHFRSCANNER_Start(false, scan_direction); + + gScanPauseDelayIn_10ms = 1; + gScheduleScanListen = false; +} + /* void CHFRSCANNER_ContinueScanning(void) { @@ -380,7 +400,10 @@ void CHFRSCANNER_ContinueScanning(void) gCurrentFunction != FUNCTION_INCOMING && !g_SquelchLost) { - ScanFastResetState(); + // A rejected full-tune candidate is just a false RSSI hit. Keep the + // learned floor; resetting here can make the next channel blind when + // it is the real signal, especially while scanning down. + scanFastLastFullTuneCandidate = false; } #endif diff --git a/App/app/chFrScanner.h b/App/app/chFrScanner.h index 51b2c9a6..84e36348 100644 --- a/App/app/chFrScanner.h +++ b/App/app/chFrScanner.h @@ -18,6 +18,7 @@ extern uint32_t gScanRangeStop; void CHFRSCANNER_Found(void); void CHFRSCANNER_Stop(void); void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_direction); +void CHFRSCANNER_ManualResume(const int8_t scan_direction); void CHFRSCANNER_ContinueScanning(void); #if defined(ENABLE_FEAT_F4HWN_RESUME_STATE) || defined(ENABLE_SCAN_RANGES) @@ -29,4 +30,4 @@ void CHFRSCANNER_ContinueScanning(void); extern uint32_t lastFoundFrqOrChanOld; #endif -#endif \ No newline at end of file +#endif diff --git a/App/app/main.c b/App/app/main.c index 35e58e03..1708a477 100644 --- a/App/app/main.c +++ b/App/app/main.c @@ -1010,9 +1010,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) } // jump to the next channel - CHFRSCANNER_Start(false, Direction); - gScanPauseDelayIn_10ms = 1; - gScheduleScanListen = false; + CHFRSCANNER_ManualResume(Direction); gPttWasReleased = true; }