mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Add named lists
This commit is contained in:
1 parent
712a984b96
commit
7957377388
7 files changed
+65
-17
No files matched your search
@@ -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)
|
||||
|
||||
|
||||
@@ -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() { ; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
+28
-6
@@ -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);
|
||||
|
||||
+17
-4
@@ -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
|
||||
|
||||
+12
-6
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user