From 7957377388ed0052b64560c2bc3dcf527ab460b9 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 10 Feb 2026 01:35:08 +0100 Subject: [PATCH] Add named lists --- App/driver/eeprom_compat.c | 3 ++- App/misc.c | 1 + App/misc.h | 2 ++ App/settings.c | 3 +++ App/ui/main.c | 34 ++++++++++++++++++++++++++++------ App/ui/menu.c | 21 +++++++++++++++++---- App/ui/status.c | 18 ++++++++++++------ 7 files changed, 65 insertions(+), 17 deletions(-) diff --git a/App/driver/eeprom_compat.c b/App/driver/eeprom_compat.c index 60bfa8db..59b5e874 100644 --- a/App/driver/eeprom_compat.c +++ b/App/driver/eeprom_compat.c @@ -48,7 +48,8 @@ static const AddrMapping_t ADDR_MAPPINGS[] = { _MK_MAPPING(0x006000, 0x006000, 0x007000), // 256 MR Name * 16 Bytes _MK_MAPPING(0x007000, 0x007000, 0x008000), // 256 MR Name * 16 Bytes - _MK_MAPPING(0x008000, 0x008000, 0x00880E), // 1024 MR + 7 VFO Attributes * 2 Bytes (ex 0x002000) + _MK_MAPPING(0x008000, 0x008000, 0x00886E), // 1024 MR + 7 VFO Attributes * 2 Bytes (ex 0x002000) 0x008000 -> 0x00880E + // List name * 4 Bytes 0x00880E -> 0x00886E _MK_MAPPING(0x009000, 0x009000, 0x0090D6), // 14 VFO * 16 Bytes (ex 0x001000) diff --git a/App/misc.c b/App/misc.c index 91cb977f..00ca1bb9 100644 --- a/App/misc.c +++ b/App/misc.c @@ -334,6 +334,7 @@ uint8_t gIsLocked = 0xFF; uint16_t gVfoSaveCountdown_10ms = 0; bool gScheduleVfoSave = false; bool gVfoStateChanged = false; + char gListName[MR_CHANNELS_LIST][4]; #endif inline void FUNCTION_NOP() { ; } diff --git a/App/misc.h b/App/misc.h index cab2e4d7..e42bcde9 100644 --- a/App/misc.h +++ b/App/misc.h @@ -455,6 +455,8 @@ extern volatile uint8_t boot_counter_10ms; extern uint16_t gVfoSaveCountdown_10ms; extern bool gScheduleVfoSave; extern bool gVfoStateChanged; + + extern char gListName[MR_CHANNELS_LIST][4]; #endif int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit); diff --git a/App/settings.c b/App/settings.c index 904353de..0216c906 100644 --- a/App/settings.c +++ b/App/settings.c @@ -403,6 +403,9 @@ gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data16[5]) ? Data16[5] : (FREQ_CHANNE } */ + // Init list name + PY25Q16_ReadBuffer(0x00880E, gListName, sizeof(gListName)); + // Init attr cache MR_InitChannelAttributesCache(); diff --git a/App/ui/main.c b/App/ui/main.c index a7f42073..6156efe5 100644 --- a/App/ui/main.c +++ b/App/ui/main.c @@ -917,13 +917,35 @@ void UI_DisplayMain(void) countList = 0; } - const char *displayStr = (countList == MR_CHANNELS_LIST + 1) ? "ALL" : - (countList == 0) ? "OFF" : String; - uint8_t xStart = (countList > 0 && countList != MR_CHANNELS_LIST + 1) ? 117 : 113; - uint8_t xDisplay = (countList > 0 && countList != MR_CHANNELS_LIST + 1) ? 119 : 115; + const char *displayStr; + uint8_t xStart, xDisplay; - if(countList > 0 && countList != MR_CHANNELS_LIST + 1) { - sprintf(String, "%02d", countList); + if (countList == MR_CHANNELS_LIST + 1) { + displayStr = "ALL"; + xStart = 113; + xDisplay = 115; + } + else if (countList == 0) { + displayStr = "OFF"; + xStart = 113; + xDisplay = 115; + } + else { + // List 1 to MR_CHANNELS_LIST + const char *name = gListName[countList - 1]; + + // If name is empty/invalid, display number + if (name[0] == '\0' || name[0] == '\xff' || name[0] == ' ') { + sprintf(String, "%02d", countList); + xStart = 117; // 2-digit number aligned right + xDisplay = 119; + } + else { + sprintf(String, "%.3s", name); + xStart = 113; // 3-char name aligned left + xDisplay = 115; + } + displayStr = String; } GUI_DisplaySmallest(displayStr, xDisplay, line == 0 ? 2 : 34, false, true); diff --git a/App/ui/menu.c b/App/ui/menu.c index a3682be4..adb86386 100644 --- a/App/ui/menu.c +++ b/App/ui/menu.c @@ -969,15 +969,28 @@ void UI_DisplayMenu(void) strcpy(String, "ALL"); else if (gSubMenuSelection == 0) strcpy(String, "OFF"); - else - sprintf(String, "%u", gSubMenuSelection); + else { + const char *name = gListName[gSubMenuSelection - 1]; + + // If first character is empty/invalid, display "N/A" + if (name[0] == '\0' || name[0] == '\xff' || name[0] == ' ') + sprintf(String, "%02u - N/A", gSubMenuSelection); + else + sprintf(String, "%02u - %.3s", gSubMenuSelection, name); + } break; case MENU_S_LIST: if (gSubMenuSelection == MR_CHANNELS_LIST + 1) strcpy(String, "ALL"); - else - sprintf(String, "%u", gSubMenuSelection); + else { + const char *name = gListName[gSubMenuSelection - 1]; + // If first character is empty/invalid, display "N/A" + if (name[0] == '\0' || name[0] == '\xff' || name[0] == ' ') + sprintf(String, "%02u - N/A", gSubMenuSelection); + else + sprintf(String, "%02u - %.3s", gSubMenuSelection, name); + } break; #ifdef ENABLE_ALARM diff --git a/App/ui/status.c b/App/ui/status.c index 05f3ea32..4db85745 100644 --- a/App/ui/status.c +++ b/App/ui/status.c @@ -111,13 +111,19 @@ void UI_DisplayStatus() } else { - if(gEeprom.SCAN_LIST_ENABLED==1) { - sprintf(str, "%02d+", gEeprom.SCAN_LIST_DEFAULT); - end = 15; - } + const char *name = gListName[gEeprom.SCAN_LIST_DEFAULT - 1]; + + // Check if name is valid + bool nameValid = (name[0] != '\0' && name[0] != '\xff' && name[0] != ' '); + + // Format the string + if (nameValid) { + sprintf(str, "%.3s%s", name, gEeprom.SCAN_LIST_ENABLED ? "+" : ""); + end = gEeprom.SCAN_LIST_ENABLED ? 19 : 15; + } else { - sprintf(str, "%02d", gEeprom.SCAN_LIST_DEFAULT); - end = 11; + sprintf(str, "%02d%s", gEeprom.SCAN_LIST_DEFAULT, gEeprom.SCAN_LIST_ENABLED ? "+" : ""); + end = gEeprom.SCAN_LIST_ENABLED ? 15 : 11; } }