0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-03 16:51:25 +03:00

Fixed channel display new bug

This commit is contained in:
OneOfEleven 2023-09-10 10:28:30 +01:00
parent b1399c8073
commit 0176cb4214
10 changed files with 122 additions and 113 deletions

View File

@ -99,6 +99,7 @@ CFLAGS += -DDISABLE_AIRCOPY
CFLAGS += -DKEEP_MEM_NAME CFLAGS += -DKEEP_MEM_NAME
CFLAGS += -DDISABLE_ALARM CFLAGS += -DDISABLE_ALARM
CFLAGS += -DCHAN_NAME_FREQ CFLAGS += -DCHAN_NAME_FREQ
CFLAGS += -DSINGLE_VFO_CHAN
#CFLAGS += -DBAND_SCOPE #CFLAGS += -DBAND_SCOPE
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)

View File

@ -17,6 +17,7 @@ You can edit those changes by (currently) editing the MakeFile, look for these l
* CFLAGS += -DKEEP_MEM_NAME .. maintain the memory channel's name when re-saving the memory channel * CFLAGS += -DKEEP_MEM_NAME .. maintain the memory channel's name when re-saving the memory channel
* CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware * CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware
* CFLAGS += -DCHAN_NAME_FREQ .. show the channel frequency (as well as channel number/name) * CFLAGS += -DCHAN_NAME_FREQ .. show the channel frequency (as well as channel number/name)
* CFLAGS += -DSINGLE_VFO_CHAN .. only show a single VFO/CHANNEL if dual watch is disabled
* #CFLAGS += -DBAND_SCOPE .. not yet implemented * #CFLAGS += -DBAND_SCOPE .. not yet implemented
To enable the custom option just uncomment the line by removing the starting '#'. To enable the custom option just uncomment the line by removing the starting '#'.

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

196
font.c
View File

@ -355,109 +355,109 @@ const uint8_t gFont6x8[96][6] =
}; };
/* /*
// ASCII 5x7 font // ASCII 5x7 font
const uint8_t gFont5x7[5 * 16 * 6] = const uint8_t gFont5x7[96][5] =
{ {
0x00, 0x00, 0x00, 0x00, 0x00, // ' ' {0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
0x00, 0x00, 0x5F, 0x00, 0x00, {0x00, 0x00, 0x5F, 0x00, 0x00},
0x00, 0x07, 0x00, 0x07, 0x00, {0x00, 0x07, 0x00, 0x07, 0x00},
0x14, 0x7F, 0x14, 0x7F, 0x14, {0x14, 0x7F, 0x14, 0x7F, 0x14},
0x24, 0x2A, 0x7F, 0x2A, 0x12, {0x24, 0x2A, 0x7F, 0x2A, 0x12},
0x23, 0x13, 0x08, 0x64, 0x62, {0x23, 0x13, 0x08, 0x64, 0x62},
0x36, 0x49, 0x56, 0x20, 0x50, {0x36, 0x49, 0x56, 0x20, 0x50},
0x00, 0x08, 0x07, 0x03, 0x00, {0x00, 0x08, 0x07, 0x03, 0x00},
0x00, 0x1C, 0x22, 0x41, 0x00, {0x00, 0x1C, 0x22, 0x41, 0x00},
0x00, 0x41, 0x22, 0x1C, 0x00, {0x00, 0x41, 0x22, 0x1C, 0x00},
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, {0x2A, 0x1C, 0x7F, 0x1C, 0x2A},
0x08, 0x08, 0x3E, 0x08, 0x08, {0x08, 0x08, 0x3E, 0x08, 0x08},
0x00, 0x80, 0x70, 0x30, 0x00, {0x00, 0x80, 0x70, 0x30, 0x00},
0x08, 0x08, 0x08, 0x08, 0x08, {0x08, 0x08, 0x08, 0x08, 0x08},
0x00, 0x00, 0x60, 0x60, 0x00, {0x00, 0x00, 0x60, 0x60, 0x00},
0x20, 0x10, 0x08, 0x04, 0x02, {0x20, 0x10, 0x08, 0x04, 0x02},
// 0x3E, 0x51, 0x49, 0x45, 0x3E, // '0' // {0x3E, 0x51, 0x49, 0x45, 0x3E}, // '0'
0x3E, 0x41, 0x41, 0x41, 0x3E, // '0' {0x3E, 0x41, 0x41, 0x41, 0x3E}, // '0'
0x00, 0x42, 0x7F, 0x40, 0x00, {0x00, 0x42, 0x7F, 0x40, 0x00},
0x72, 0x49, 0x49, 0x49, 0x46, {0x72, 0x49, 0x49, 0x49, 0x46},
0x21, 0x41, 0x49, 0x4D, 0x33, {0x21, 0x41, 0x49, 0x4D, 0x33},
0x18, 0x14, 0x12, 0x7F, 0x10, {0x18, 0x14, 0x12, 0x7F, 0x10},
0x27, 0x45, 0x45, 0x45, 0x39, {0x27, 0x45, 0x45, 0x45, 0x39},
0x3C, 0x4A, 0x49, 0x49, 0x31, {0x3C, 0x4A, 0x49, 0x49, 0x31},
0x41, 0x21, 0x11, 0x09, 0x07, {0x41, 0x21, 0x11, 0x09, 0x07},
0x36, 0x49, 0x49, 0x49, 0x36, {0x36, 0x49, 0x49, 0x49, 0x36},
0x46, 0x49, 0x49, 0x29, 0x1E, {0x46, 0x49, 0x49, 0x29, 0x1E},
0x00, 0x00, 0x14, 0x00, 0x00, {0x00, 0x00, 0x14, 0x00, 0x00},
0x00, 0x40, 0x34, 0x00, 0x00, {0x00, 0x40, 0x34, 0x00, 0x00},
0x00, 0x08, 0x14, 0x22, 0x41, {0x00, 0x08, 0x14, 0x22, 0x41},
0x14, 0x14, 0x14, 0x14, 0x14, {0x14, 0x14, 0x14, 0x14, 0x14},
0x00, 0x41, 0x22, 0x14, 0x08, {0x00, 0x41, 0x22, 0x14, 0x08},
0x02, 0x01, 0x59, 0x09, 0x06, {0x02, 0x01, 0x59, 0x09, 0x06},
0x3E, 0x41, 0x5D, 0x59, 0x4E, // '@' {0x3E, 0x41, 0x5D, 0x59, 0x4E}, // '@'
0x7C, 0x12, 0x11, 0x12, 0x7C, // 'A' {0x7C, 0x12, 0x11, 0x12, 0x7C}, // 'A'
0x7F, 0x49, 0x49, 0x49, 0x36, {0x7F, 0x49, 0x49, 0x49, 0x36},
0x3E, 0x41, 0x41, 0x41, 0x22, {0x3E, 0x41, 0x41, 0x41, 0x22},
0x7F, 0x41, 0x41, 0x41, 0x3E, {0x7F, 0x41, 0x41, 0x41, 0x3E},
0x7F, 0x49, 0x49, 0x49, 0x41, {0x7F, 0x49, 0x49, 0x49, 0x41},
0x7F, 0x09, 0x09, 0x09, 0x01, {0x7F, 0x09, 0x09, 0x09, 0x01},
0x3E, 0x41, 0x41, 0x51, 0x73, {0x3E, 0x41, 0x41, 0x51, 0x73},
0x7F, 0x08, 0x08, 0x08, 0x7F, {0x7F, 0x08, 0x08, 0x08, 0x7F},
0x00, 0x41, 0x7F, 0x41, 0x00, {0x00, 0x41, 0x7F, 0x41, 0x00},
0x20, 0x40, 0x41, 0x3F, 0x01, {0x20, 0x40, 0x41, 0x3F, 0x01},
0x7F, 0x08, 0x14, 0x22, 0x41, {0x7F, 0x08, 0x14, 0x22, 0x41},
0x7F, 0x40, 0x40, 0x40, 0x40, {0x7F, 0x40, 0x40, 0x40, 0x40},
0x7F, 0x02, 0x1C, 0x02, 0x7F, {0x7F, 0x02, 0x1C, 0x02, 0x7F},
0x7F, 0x04, 0x08, 0x10, 0x7F, {0x7F, 0x04, 0x08, 0x10, 0x7F},
0x3E, 0x41, 0x41, 0x41, 0x3E, {0x3E, 0x41, 0x41, 0x41, 0x3E},
0x7F, 0x09, 0x09, 0x09, 0x06, {0x7F, 0x09, 0x09, 0x09, 0x06},
0x3E, 0x41, 0x51, 0x21, 0x5E, {0x3E, 0x41, 0x51, 0x21, 0x5E},
0x7F, 0x09, 0x19, 0x29, 0x46, {0x7F, 0x09, 0x19, 0x29, 0x46},
0x26, 0x49, 0x49, 0x49, 0x32, {0x26, 0x49, 0x49, 0x49, 0x32},
0x03, 0x01, 0x7F, 0x01, 0x03, {0x03, 0x01, 0x7F, 0x01, 0x03},
0x3F, 0x40, 0x40, 0x40, 0x3F, {0x3F, 0x40, 0x40, 0x40, 0x3F},
0x1F, 0x20, 0x40, 0x20, 0x1F, {0x1F, 0x20, 0x40, 0x20, 0x1F},
0x3F, 0x40, 0x38, 0x40, 0x3F, {0x3F, 0x40, 0x38, 0x40, 0x3F},
0x63, 0x14, 0x08, 0x14, 0x63, {0x63, 0x14, 0x08, 0x14, 0x63},
0x03, 0x04, 0x78, 0x04, 0x03, {0x03, 0x04, 0x78, 0x04, 0x03},
0x61, 0x59, 0x49, 0x4D, 0x43, {0x61, 0x59, 0x49, 0x4D, 0x43},
0x00, 0x7F, 0x41, 0x41, 0x41, {0x00, 0x7F, 0x41, 0x41, 0x41},
0x02, 0x04, 0x08, 0x10, 0x20, {0x02, 0x04, 0x08, 0x10, 0x20},
0x00, 0x41, 0x41, 0x41, 0x7F, {0x00, 0x41, 0x41, 0x41, 0x7F},
0x04, 0x02, 0x01, 0x02, 0x04, {0x04, 0x02, 0x01, 0x02, 0x04},
0x40, 0x40, 0x40, 0x40, 0x40, {0x40, 0x40, 0x40, 0x40, 0x40},
0x00, 0x03, 0x07, 0x08, 0x00, {0x00, 0x03, 0x07, 0x08, 0x00},
0x20, 0x54, 0x54, 0x78, 0x40, {0x20, 0x54, 0x54, 0x78, 0x40},
0x7F, 0x28, 0x44, 0x44, 0x38, {0x7F, 0x28, 0x44, 0x44, 0x38},
0x38, 0x44, 0x44, 0x44, 0x28, {0x38, 0x44, 0x44, 0x44, 0x28},
0x38, 0x44, 0x44, 0x28, 0x7F, {0x38, 0x44, 0x44, 0x28, 0x7F},
0x38, 0x54, 0x54, 0x54, 0x18, {0x38, 0x54, 0x54, 0x54, 0x18},
0x00, 0x08, 0x7E, 0x09, 0x02, {0x00, 0x08, 0x7E, 0x09, 0x02},
0x18, 0xA4, 0xA4, 0x9C, 0x78, {0x18, 0xA4, 0xA4, 0x9C, 0x78},
0x7F, 0x08, 0x04, 0x04, 0x78, {0x7F, 0x08, 0x04, 0x04, 0x78},
0x00, 0x44, 0x7D, 0x40, 0x00, {0x00, 0x44, 0x7D, 0x40, 0x00},
0x20, 0x40, 0x40, 0x3D, 0x00, {0x20, 0x40, 0x40, 0x3D, 0x00},
0x7F, 0x10, 0x28, 0x44, 0x00, {0x7F, 0x10, 0x28, 0x44, 0x00},
0x00, 0x41, 0x7F, 0x40, 0x00, {0x00, 0x41, 0x7F, 0x40, 0x00},
0x7C, 0x04, 0x78, 0x04, 0x78, {0x7C, 0x04, 0x78, 0x04, 0x78},
0x7C, 0x08, 0x04, 0x04, 0x78, {0x7C, 0x08, 0x04, 0x04, 0x78},
0x38, 0x44, 0x44, 0x44, 0x38, {0x38, 0x44, 0x44, 0x44, 0x38},
0xFC, 0x18, 0x24, 0x24, 0x18, {0xFC, 0x18, 0x24, 0x24, 0x18},
0x18, 0x24, 0x24, 0x18, 0xFC, {0x18, 0x24, 0x24, 0x18, 0xFC},
0x7C, 0x08, 0x04, 0x04, 0x08, {0x7C, 0x08, 0x04, 0x04, 0x08},
0x48, 0x54, 0x54, 0x54, 0x24, {0x48, 0x54, 0x54, 0x54, 0x24},
0x04, 0x04, 0x3F, 0x44, 0x24, {0x04, 0x04, 0x3F, 0x44, 0x24},
0x3C, 0x40, 0x40, 0x20, 0x7C, {0x3C, 0x40, 0x40, 0x20, 0x7C},
0x1C, 0x20, 0x40, 0x20, 0x1C, {0x1C, 0x20, 0x40, 0x20, 0x1C},
0x3C, 0x40, 0x30, 0x40, 0x3C, {0x3C, 0x40, 0x30, 0x40, 0x3C},
0x44, 0x28, 0x10, 0x28, 0x44, {0x44, 0x28, 0x10, 0x28, 0x44},
0x4C, 0x90, 0x90, 0x90, 0x7C, {0x4C, 0x90, 0x90, 0x90, 0x7C},
0x44, 0x64, 0x54, 0x4C, 0x44, {0x44, 0x64, 0x54, 0x4C, 0x44},
0x00, 0x08, 0x36, 0x41, 0x00, {0x00, 0x08, 0x36, 0x41, 0x00},
0x00, 0x00, 0x77, 0x00, 0x00, {0x00, 0x00, 0x77, 0x00, 0x00},
0x00, 0x41, 0x36, 0x08, 0x00, {0x00, 0x41, 0x36, 0x08, 0x00},
0x02, 0x01, 0x02, 0x04, 0x02, {0x02, 0x01, 0x02, 0x04, 0x02},
0x3C, 0x26, 0x23, 0x26, 0x3C {0x3C, 0x26, 0x23, 0x26, 0x3C}
}; };
*/ */

2
font.h
View File

@ -25,7 +25,7 @@ extern const uint8_t gFontSmallDigits[11][7];
//extern const uint64_t gFont8x8[16 * 6]; //extern const uint64_t gFont8x8[16 * 6];
extern const uint8_t gFont6x8[96][6]; extern const uint8_t gFont6x8[96][6];
//extern const uint8_t gFont5x7[5 * 16 * 6]; //extern const uint8_t gFont5x7[96][5];
#endif #endif

View File

@ -497,7 +497,7 @@ void RADIO_SelectVfos(void)
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL]; gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL; gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
else else
gEeprom.RX_CHANNEL = (gEeprom.TX_CHANNEL == 0) ? 1 : 0; gEeprom.RX_CHANNEL = (gEeprom.TX_CHANNEL == 0) ? 1 : 0;

View File

@ -96,11 +96,11 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{ {
if (pString[i] >= 32) if (pString[i] >= 32)
{ {
const unsigned int Index = ((unsigned int)pString[i] - 32) * 5; const unsigned int Index = ((unsigned int)pString[i] - 32);
if (Index < sizeof(gFont5x7)) if (Index < ARRAY_SIZE(gFont5x7))
{ {
const unsigned int ofs = (unsigned int)Start + (i * 8); const unsigned int ofs = (unsigned int)Start + (i * 6);
memcpy(gFrameBuffer[Line] + ofs, &gFont5x7[Index], 5); memcpy(gFrameBuffer[Line] + ofs, &gFont5x7[Index], ARRAY_SIZE(gFont5x7[Index]));
} }
} }
} }
@ -114,8 +114,8 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
const unsigned int Index = (unsigned int)pString[i] - 32; const unsigned int Index = (unsigned int)pString[i] - 32;
if (Index < ARRAY_SIZE(gFont6x8)) if (Index < ARRAY_SIZE(gFont6x8))
{ {
const unsigned int ofs = (unsigned int)Start + (i * 8); const unsigned int ofs = (unsigned int)Start + (i * 7);
memcpy(gFrameBuffer[Line] + ofs, &gFont6x8[Index], 6); memcpy(gFrameBuffer[Line] + ofs, &gFont6x8[Index], ARRAY_SIZE(gFont6x8[Index]));
} }
} }
} }

View File

@ -43,7 +43,11 @@ void UI_DisplayMain(void)
return; return;
} }
//#ifndef SINGLE_VFO_CHAN
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
//#else
// vfo_num = 0;
//#endif
{ {
uint8_t Channel = gEeprom.TX_CHANNEL; uint8_t Channel = gEeprom.TX_CHANNEL;
bool bIsSameVfo = !!(Channel == vfo_num); bool bIsSameVfo = !!(Channel == vfo_num);
@ -274,7 +278,11 @@ void UI_DisplayMain(void)
{ {
case MDF_FREQUENCY: case MDF_FREQUENCY:
NUMBER_ToDigits(frequency_Hz, String); NUMBER_ToDigits(frequency_Hz, String);
// show the first lot of the frequency digits
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false); UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
// show the remaining 2 frequency digits
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
@ -285,12 +293,11 @@ void UI_DisplayMain(void)
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList)); memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
} }
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
frequency_Hz = 0; frequency_Hz = 0;
break; break;
case MDF_CHANNEL: case MDF_CHANNEL:
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true); UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
frequency_Hz = 0; frequency_Hz = 0;
break; break;
@ -313,13 +320,13 @@ void UI_DisplayMain(void)
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF) if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // channel number { // channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1); sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 1, false); UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 16, 0, (vfo_num * 4) + 0, false);
} }
else else
{ // channel name { // channel name
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 8); memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 8);
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 1, false); UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 16, 0, (vfo_num * 4) + 0, false);
} }
break; break;
#endif #endif
@ -460,13 +467,13 @@ void UI_DisplayMain(void)
#ifdef CHAN_NAME_FREQ #ifdef CHAN_NAME_FREQ
if (frequency_Hz > 0) if (frequency_Hz > 0)
{ // show the channel frequency above the channel number/name { // show the channel frequency below the channel number/name
#if 0 #if 0
NUMBER_ToDigits(frequency_Hz, String); // 8 digits NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequencySmall(String, 31 + 8, (vfo_num * 4) + 0, false); UI_DisplayFrequencySmall(String, 31 + 8, (vfo_num * 4) + 1, false);
#else #else
sprintf(String, "%9.5f", frequency_Hz * 0.00001); sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintStringSmall(String, 31 + 8, 0, (vfo_num * 4) + 0, false); UI_PrintStringSmall(String, 31 + 16, 0, (vfo_num * 4) + 1, false);
#endif #endif
} }
#endif #endif