diff --git a/firmware b/firmware index 32be625..4e5f75f 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index 6bc4618..4e6b6ce 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 60b598d..2f70074 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/settings.c b/settings.c index d896fce..6ada648 100644 --- a/settings.c +++ b/settings.c @@ -215,11 +215,10 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, if (IS_MR_CHANNEL(Channel)) { // clear/reset the channel name memset(&State8, 0xFF, sizeof(State8)); - EEPROM_WriteBuffer(0x0F50 + OffsetMR + , State8); + EEPROM_WriteBuffer(0x0F50 + OffsetMR, State8); EEPROM_WriteBuffer(0x0F58 + OffsetMR, State8); } #endif - } } } diff --git a/ui/helper.c b/ui/helper.c index 410771b..b2633f4 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -21,7 +21,7 @@ #include "ui/helper.h" #include "ui/inputbox.h" -void UI_GenerateChannelString(char *pString, uint8_t Channel) +void UI_GenerateChannelString(char *pString, const uint8_t Channel) { unsigned int i; @@ -38,7 +38,7 @@ void UI_GenerateChannelString(char *pString, uint8_t Channel) pString[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0'; } -void UI_GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber) +void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber) { if (gInputBoxIndex) { diff --git a/ui/helper.h b/ui/helper.h index a232583..984e2b0 100644 --- a/ui/helper.h +++ b/ui/helper.h @@ -20,8 +20,8 @@ #include #include -void UI_GenerateChannelString(char *pString, uint8_t Channel); -void UI_GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber); +void UI_GenerateChannelString(char *pString, const uint8_t Channel); +void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber); void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered); void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag); void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y); diff --git a/ui/main.c b/ui/main.c index a079c0a..23b61c3 100644 --- a/ui/main.c +++ b/ui/main.c @@ -136,7 +136,7 @@ void UI_DisplayMain(void) UI_PrintString(String, 2, 127, 2 + (i * 3), 8, false); continue; } - + if (bIsSameVfo) memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); } @@ -228,7 +228,7 @@ void UI_DisplayMain(void) State = VFO_STATE_ALARM; } #endif - + if (State) { uint8_t Width = 10; @@ -257,7 +257,7 @@ void UI_DisplayMain(void) Width = 8; break; } - + UI_PrintString(String, 31, 111, i * 4, Width, true); } else @@ -273,41 +273,50 @@ void UI_DisplayMain(void) switch (gEeprom.CHANNEL_DISPLAY_MODE) { case MDF_FREQUENCY: - if (gCurrentFunction == FUNCTION_TRANSMIT) { - if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) { + if (gCurrentFunction == FUNCTION_TRANSMIT) + { + if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) Channel = gEeprom.RX_CHANNEL; - } else { + else Channel = gEeprom.TX_CHANNEL; - } - if (Channel == i) { + + if (Channel == i) NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String); - } else { + else NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String); - } - } else { + } + else NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String); - } + UI_DisplayFrequency(String, 31, i * 4, false, false); - if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) { + + if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) + { const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]]; - if (Attributes & MR_CH_SCANLIST1) { + + if (Attributes & MR_CH_SCANLIST1) memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList)); - } - if (Attributes & MR_CH_SCANLIST2) { + + if (Attributes & MR_CH_SCANLIST2) memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList)); - } } + UI_DisplaySmallDigits(2, String + 6, 112, Line + 1); break; + case MDF_CHANNEL: sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1); UI_PrintString(String, 31, 112, i * 4, 8, true); break; + case MDF_NAME: - if(gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF) { + if (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF) + { sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1); UI_PrintString(String, 31, 112, i * 4, 8, true); - } else { + } + else + { UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true); } break; diff --git a/ui/menu.c b/ui/menu.c index 0723732..d760585 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -522,27 +522,61 @@ void UI_DisplayMenu(void) } } else - { - UI_PrintString(String, 50, 127, 2, 8, true); - } - if (gMenuCursor == MENU_VOL) { // 2nd text line .. percentage + UI_PrintString(String, 50, 127, 1, 8, true); const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : (gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v : gBatteryVoltageAverage; sprintf(String, "%u%%", (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v)); - UI_PrintString(String, 50, 127, 4, 8, true); + UI_PrintString(String, 50, 127, 3, 8, true); + } + else + if (gMenuCursor == MENU_OFFSET) + { + UI_PrintString(String, 50, 127, 1, 8, true); + UI_PrintString("MHz", 50, 127, 3, 8, true); + } + else + { + UI_PrintString(String, 50, 127, 2, 8, true); } - if (gMenuCursor == MENU_OFFSET) - UI_PrintString("MHz", 50, 127, 4, 8, true); - if ((gMenuCursor == MENU_RESET || gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && gAskForConfirmation) - { + { // display confirmation strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!"); UI_PrintString(String, 50, 127, 4, 8, true); } + else + if ((gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && !gAskForConfirmation) + { // display the channel name + const uint16_t channel = (uint16_t)gSubMenuSelection; + const bool valid = RADIO_CheckValidChannel(channel, false, 0); + if (valid) + { // 16 bytes allocated to the channel name but only 12 used + char s[17] = {0}; + EEPROM_ReadBuffer(0x0F50 + (channel * 16), s + 0, 8); + EEPROM_ReadBuffer(0x0F58 + (channel * 16), s + 8, 2); + { // make invalid chars '0' + i = 0; + while (i < sizeof(s)) + { + if (s[i] < 32 || s[i] >= 128) + break; + i++; + } + while (i < sizeof(s)) + s[i++] = 0; + while (--i > 0) + { + if (s[i] != 0 && s[i] != 32) + break; + s[i] = 0; + } + } + UI_PrintString(s, 50, 127, 4, 8, true); + } + } if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF) UI_PrintString("SCAN", 50, 127, 4, 8, true);