Show active scan list name when it changes during scan (discussion #462)

This commit is contained in:
Armel FAUVEAU committed 2026-07-22 04:05:07 +02:00
1 parent dd3fc786b5
commit 65ec12bb0d
5 files changed
+74 -13

No files matched your search

+62 -7
View File
@@ -68,6 +68,7 @@ center_line_t center_line = CENTER_LINE_NONE;
#ifdef ENABLE_FEAT_F4HWN_SCAN_PROGRESS
#define SCAN_PROGRESS_MR_CHANNEL_BYTES ((MR_CHANNELS_MAX + 7u) / 8u)
#define SCAN_LIST_NAME_HOLD_500MS (2000u / 500u)
static bool gScanProgressSessionActive;
static bool gScanProgressSessionIsMemory;
@@ -82,6 +83,7 @@ static bool gScanProgressPrevResetVfosFlag;
static bool gScanProgressForceRebuild;
static uint16_t gScanProgressLastMemoryIndex;
static uint8_t gScanProgressPriorityState;
static uint8_t gScanListNameCountdown_500ms;
#define SCAN_PROGRESS_PRIORITY_LABEL_MASK 0x03u
#define SCAN_PROGRESS_PRIORITY_SEEN_SHIFT 2
#define SCAN_PROGRESS_PRIORITY_SEEN_MASK 0x1cu
@@ -90,15 +92,24 @@ static uint8_t gScanProgressPriorityState;
#define SCAN_PROGRESS_PRIORITY_HOLD_FRAMES 6
#endif
#if defined(ENABLE_FEAT_F4HWN_BEAM) || defined(ENABLE_FEAT_F4HWN_SCAN_PROGRESS)
// Shared center-line renderer: clear the line and print bold text on it.
static void UI_MAIN_DrawCenterBoldLine(const char *text, uint8_t start)
{
#ifdef ENABLE_FEAT_F4HWN
const uint8_t line = isMainOnly() ? 5 : 3;
#else
const uint8_t line = 3;
#endif
memset(gFrameBuffer[line], 0, LCD_WIDTH);
UI_PrintStringSmallBold(text, start, LCD_WIDTH - 1, line);
}
#endif
#ifdef ENABLE_FEAT_F4HWN_BEAM
static void UI_MAIN_DrawBeamLine(void)
{
const char *text;
#ifdef ENABLE_FEAT_F4HWN
const unsigned int line = isMainOnly() ? 5 : 3;
#else
const unsigned int line = 3;
#endif
switch (gBeamStatus) {
case BEAM_STATUS_TX_WAIT:
@@ -125,8 +136,7 @@ static void UI_MAIN_DrawBeamLine(void)
break;
}
memset(gFrameBuffer[line], 0, LCD_WIDTH);
UI_PrintStringSmallBold(text, 2, 127, line);
UI_MAIN_DrawCenterBoldLine(text, 2);
}
#endif
@@ -214,6 +224,7 @@ static void ScanProgress_ResetSession(void)
gScanProgressForceRebuild = false;
gScanProgressLastMemoryIndex = 0;
gScanProgressPriorityState = 0;
gScanListNameCountdown_500ms = 0;
}
void UI_MAIN_NotifyScanProgressDataChanged(void)
@@ -222,6 +233,13 @@ void UI_MAIN_NotifyScanProgressDataChanged(void)
gUpdateStatus = true;
}
void UI_MAIN_NotifyScanListChanged(void)
{
UI_MAIN_NotifyScanProgressDataChanged();
gScanListNameCountdown_500ms = SCAN_LIST_NAME_HOLD_500MS;
gUpdateDisplay = true;
}
static inline void ScanProgress_SetBit(uint8_t *map, uint16_t ch)
{
map[ch >> 3] |= (uint8_t)(1u << (ch & 7));
@@ -243,6 +261,33 @@ static uint8_t ScanProgress_GetActiveScanList(void)
return scan_list;
}
static void UI_MAIN_DrawScanListName(void)
{
const uint8_t scan_list = ScanProgress_GetActiveScanList();
char text[16];
// Manual formatting instead of snprintf: much smaller on a divide-less M0 core
strcpy(text, "SCAN LIST ");
char *p = text + 10; // sizeof("SCAN LIST ") - 1
if (scan_list > MR_CHANNELS_LIST) {
*p++ = 'A'; *p++ = 'L'; *p++ = 'L';
} else {
const char *name = gListName[scan_list - 1];
if (IsEmptyName(name, sizeof(gListName[0]))) {
*p++ = (char)('0' + scan_list / 10);
*p++ = (char)('0' + scan_list % 10);
} else {
for (uint8_t i = 0; i < 3 && name[i]; i++)
*p++ = name[i];
}
}
*p = '\0';
UI_MAIN_DrawCenterBoldLine(text, 0);
}
static bool ScanProgress_ChannelBelongsToList(uint16_t channel, const ChannelAttributes_t *att, uint8_t scan_list)
{
if (!IS_MR_CHANNEL(channel))
@@ -490,6 +535,12 @@ static bool UI_DrawScanProgress(void)
return false;
}
// Right after a scan-list change, briefly show its name instead of the progress bar
if (show_memory && gScanListNameCountdown_500ms > 0) {
UI_MAIN_DrawScanListName();
return true;
}
if (show_memory) {
const uint8_t scan_list = ScanProgress_GetActiveScanList();
const bool reset_vfos_edge = gFlagResetVfos && !gScanProgressPrevResetVfosFlag;
@@ -1167,6 +1218,10 @@ void UI_MAIN_PrintAGC(bool now)
void UI_MAIN_TimeSlice500ms(void)
{
if(gScreenToDisplay==DISPLAY_MAIN) {
#ifdef ENABLE_FEAT_F4HWN_SCAN_PROGRESS
if (gScanListNameCountdown_500ms > 0 && --gScanListNameCountdown_500ms == 0)
gUpdateDisplay = true;
#endif
#ifdef ENABLE_AGC_SHOW_DATA
UI_MAIN_PrintAGC(true);
return;
+2
View File
@@ -55,8 +55,10 @@ void UI_DisplayMain(void);
#ifdef ENABLE_FEAT_F4HWN_SCAN_PROGRESS
void UI_MAIN_NotifyScanProgressDataChanged(void);
void UI_MAIN_NotifyScanListChanged(void);
#else
static inline void UI_MAIN_NotifyScanProgressDataChanged(void) {}
static inline void UI_MAIN_NotifyScanListChanged(void) {}
#endif
#ifdef ENABLE_AGC_SHOW_DATA