From 528678a31bee89f41b1c37022a3b52d78b39a840 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 9 Aug 2026 23:44:40 +0200 Subject: [PATCH] Hold scan resume during scan list name (memory scan only) --- App/app/app.c | 6 ++++-- App/ui/main.c | 14 ++++++++++++++ App/ui/main.h | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/App/app/app.c b/App/app/app.c index b26f59bd..92774366 100644 --- a/App/app/app.c +++ b/App/app/app.c @@ -1245,9 +1245,11 @@ void APP_Update(void) #endif #ifdef ENABLE_VOICE - if (!SCANNER_IsScanning() && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0) + if (!SCANNER_IsScanning() && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0 + && !UI_MAIN_ShouldHoldScanResume()) #else - if (!SCANNER_IsScanning() && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed) + if (!SCANNER_IsScanning() && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed + && !UI_MAIN_ShouldHoldScanResume()) #endif { // scanning CHFRSCANNER_ContinueScanning(); diff --git a/App/ui/main.c b/App/ui/main.c index 66b1204c..72f6e881 100644 --- a/App/ui/main.c +++ b/App/ui/main.c @@ -240,6 +240,20 @@ void UI_MAIN_NotifyScanListChanged(void) gUpdateDisplay = true; } +// True while the "SCAN LIST xxx" name actually occupies the screen. Used to +// freeze the scan so it does not race ahead of the (hidden) progress gauge, +// which would make the bar snap forward when it reappears. +// +// The IS_MR_CHANNEL() test mirrors show_memory in UI_DrawScanProgress(): the +// name is only ever drawn during a memory (channel) scan. A frequency/range +// scan can still arm the countdown (F + UP/DOWN cycles lists on any scan), but +// no name is shown there, so it must NOT be held - otherwise the scanner would +// stall ~2 s with nothing on screen to explain the pause. +bool UI_MAIN_ShouldHoldScanResume(void) +{ + return gScanListNameCountdown_500ms > 0 && IS_MR_CHANNEL(gNextMrChannel); +} + static inline void ScanProgress_SetBit(uint8_t *map, uint16_t ch) { map[ch >> 3] |= (uint8_t)(1u << (ch & 7)); diff --git a/App/ui/main.h b/App/ui/main.h index 777b26f1..db839d06 100644 --- a/App/ui/main.h +++ b/App/ui/main.h @@ -18,6 +18,7 @@ #define UI_MAIN_H #include +#include enum center_line_t { CENTER_LINE_NONE = 0, @@ -56,9 +57,11 @@ void UI_DisplayMain(void); #ifdef ENABLE_FEAT_F4HWN_SCAN_PROGRESS void UI_MAIN_NotifyScanProgressDataChanged(void); void UI_MAIN_NotifyScanListChanged(void); +bool UI_MAIN_ShouldHoldScanResume(void); #else static inline void UI_MAIN_NotifyScanProgressDataChanged(void) {} static inline void UI_MAIN_NotifyScanListChanged(void) {} +static inline bool UI_MAIN_ShouldHoldScanResume(void) { return false; } #endif #ifdef ENABLE_AGC_SHOW_DATA