mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Channel menu items show channel name
This commit is contained in:
parent
2dd6791f7a
commit
0c17c658c1
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -215,11 +215,10 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{ // clear/reset the channel name
|
{ // clear/reset the channel name
|
||||||
memset(&State8, 0xFF, sizeof(State8));
|
memset(&State8, 0xFF, sizeof(State8));
|
||||||
EEPROM_WriteBuffer(0x0F50 + OffsetMR + , State8);
|
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State8);
|
||||||
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State8);
|
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State8);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "ui/helper.h"
|
#include "ui/helper.h"
|
||||||
#include "ui/inputbox.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;
|
unsigned int i;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ void UI_GenerateChannelString(char *pString, uint8_t Channel)
|
|||||||
pString[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
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)
|
if (gInputBoxIndex)
|
||||||
{
|
{
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void UI_GenerateChannelString(char *pString, uint8_t Channel);
|
void UI_GenerateChannelString(char *pString, const uint8_t Channel);
|
||||||
void UI_GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber);
|
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_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_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);
|
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y);
|
||||||
|
41
ui/main.c
41
ui/main.c
@ -273,41 +273,50 @@ void UI_DisplayMain(void)
|
|||||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||||
{
|
{
|
||||||
case MDF_FREQUENCY:
|
case MDF_FREQUENCY:
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT) {
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) {
|
{
|
||||||
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||||
Channel = gEeprom.RX_CHANNEL;
|
Channel = gEeprom.RX_CHANNEL;
|
||||||
} else {
|
else
|
||||||
Channel = gEeprom.TX_CHANNEL;
|
Channel = gEeprom.TX_CHANNEL;
|
||||||
}
|
|
||||||
if (Channel == i) {
|
if (Channel == i)
|
||||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
|
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
|
||||||
} else {
|
else
|
||||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
||||||
}
|
|
||||||
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
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]];
|
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));
|
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));
|
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDF_CHANNEL:
|
case MDF_CHANNEL:
|
||||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
||||||
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDF_NAME:
|
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);
|
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
||||||
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
|
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
52
ui/menu.c
52
ui/menu.c
@ -522,27 +522,61 @@ void UI_DisplayMenu(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
UI_PrintString(String, 50, 127, 2, 8, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gMenuCursor == MENU_VOL)
|
if (gMenuCursor == MENU_VOL)
|
||||||
{ // 2nd text line .. percentage
|
{ // 2nd text line .. percentage
|
||||||
|
UI_PrintString(String, 50, 127, 1, 8, true);
|
||||||
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v :
|
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v :
|
||||||
(gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v :
|
(gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v :
|
||||||
gBatteryVoltageAverage;
|
gBatteryVoltageAverage;
|
||||||
sprintf(String, "%u%%", (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
|
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)
|
if ((gMenuCursor == MENU_RESET || gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
||||||
{
|
{ // display confirmation
|
||||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||||
UI_PrintString(String, 50, 127, 4, 8, true);
|
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)
|
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
UI_PrintString("SCAN", 50, 127, 4, 8, true);
|
UI_PrintString("SCAN", 50, 127, 4, 8, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user