0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

Display tidy ups

This commit is contained in:
OneOfEleven 2023-09-12 15:31:37 +01:00
parent 08658f8b82
commit 4dfa882770
15 changed files with 145 additions and 141 deletions

View File

@ -99,10 +99,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
NUMBER_Get(gInputBox, &Frequency); NUMBER_Get(gInputBox, &Frequency);
if (gSetting_350EN || (4999990 < (Frequency - 35000000))) if (gSetting_350EN || Frequency < 35000000 || Frequency >= 40000000)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
{ {
if (Frequency <= gUpperLimitFrequencyBandTable[i] && (gLowerLimitFrequencyBandTable[i] <= Frequency)) if (Frequency <= gUpperLimitFrequencyBandTable[i] && (gLowerLimitFrequencyBandTable[i] <= Frequency))
@ -110,6 +109,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
#ifndef DISABLE_VOICE #ifndef DISABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
#endif #endif
if (gTxVfo->Band != i) if (gTxVfo->Band != i)
{ {
gTxVfo->Band = i; gTxVfo->Band = i;
@ -117,15 +117,13 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gEeprom.FreqChannel[Vfo] = i + FREQ_CHANNEL_FIRST; gEeprom.FreqChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
SETTINGS_SaveVfoIndices(); SETTINGS_SaveVfoIndices();
RADIO_ConfigureChannel(Vfo, 2); RADIO_ConfigureChannel(Vfo, 2);
} }
Frequency += 75; Frequency += 75;
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep( gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, gLowerLimitFrequencyBandTable[gTxVfo->Band]);
Frequency,
gTxVfo->StepFrequency,
gLowerLimitFrequencyBandTable[gTxVfo->Band]);
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;

View File

@ -408,7 +408,7 @@ const uint8_t BITMAP_M[] =
0b01111111 0b01111111
}; };
const uint8_t BITMAP_F[] = const uint8_t BITMAP_FB[] =
{ {
0b00000000, 0b00000000,
0b01111111, 0b01111111,
@ -417,7 +417,16 @@ const uint8_t BITMAP_F[] =
0b00001001, 0b00001001,
0b00001001, 0b00001001,
0b00001001, 0b00001001,
0b00000001 0b00000001,
0b00000000,
0b01111111,
0b01001001,
0b01001001,
0b01001001,
0b01001001,
0b01001001,
0b00110110
}; };
const uint8_t BITMAP_ReverseMode[] = const uint8_t BITMAP_ReverseMode[] =

View File

@ -47,7 +47,7 @@ extern const uint8_t BITMAP_TX[16];
extern const uint8_t BITMAP_RX[16]; extern const uint8_t BITMAP_RX[16];
extern const uint8_t BITMAP_M[8]; extern const uint8_t BITMAP_M[8];
extern const uint8_t BITMAP_F[8]; extern const uint8_t BITMAP_FB[16];
extern const uint8_t BITMAP_ReverseMode[8]; extern const uint8_t BITMAP_ReverseMode[8];

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -40,7 +40,7 @@ void UI_DisplayAircopy(void)
strcpy(String, "AIR COPY"); strcpy(String, "AIR COPY");
else else
strcpy(String, "AIR COPY(CMP)"); strcpy(String, "AIR COPY(CMP)");
UI_PrintString(String, 2, 127, 0, 8, true); UI_PrintString(String, 2, 127, 0, 8);
if (gInputBoxIndex == 0) if (gInputBoxIndex == 0)
{ {
@ -57,7 +57,7 @@ void UI_DisplayAircopy(void)
else else
if (gAirCopyIsSendMode == 1) if (gAirCopyIsSendMode == 1)
sprintf(String, "SND:%d", gAirCopyBlockNumber); sprintf(String, "SND:%d", gAirCopyBlockNumber);
UI_PrintString(String, 2, 127, 4, 8, true); UI_PrintString(String, 2, 127, 4, 8);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }

View File

@ -35,7 +35,7 @@ void UI_DisplayFM(void)
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
strcpy(String, "FM"); strcpy(String, "FM");
UI_PrintString(String, 0, 127, 0, 12, true); UI_PrintString(String, 0, 127, 0, 12);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gAskToSave) { if (gAskToSave) {
@ -66,7 +66,7 @@ void UI_DisplayFM(void)
} }
} }
UI_PrintString(String, 0, 127, 2, 10, true); UI_PrintString(String, 0, 127, 2, 10);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) { if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) {
@ -84,7 +84,7 @@ void UI_DisplayFM(void)
sprintf(String, "CH-%02d", gEeprom.FM_SelectedChannel + 1); sprintf(String, "CH-%02d", gEeprom.FM_SelectedChannel + 1);
} }
UI_PrintString(String, 0, 127, 4, 10, true); UI_PrintString(String, 0, 127, 4, 10);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }

View File

@ -62,12 +62,12 @@ void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uin
sprintf(pString, "%03d", ChannelNumber + 1); sprintf(pString, "%03d", ChannelNumber + 1);
} }
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)
{ {
size_t i; size_t i;
size_t Length = strlen(pString); size_t Length = strlen(pString);
if (bCentered) if (End > Start)
Start += (((End - Start) - (Length * Width)) + 1) / 2; Start += (((End - Start) - (Length * Width)) + 1) / 2;
for (i = 0; i < Length; i++) for (i = 0; i < Length; i++)
@ -82,12 +82,12 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
} }
} }
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, bool bCentered) void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line)
{ {
const size_t Length = strlen(pString); const size_t Length = strlen(pString);
size_t i; size_t i;
if (bCentered) if (End > Start)
Start += (((End - Start) - (Length * 8)) + 1) / 2; Start += (((End - Start) - (Length * 8)) + 1) / 2;
#if 1 #if 1

View File

@ -22,8 +22,8 @@
void UI_GenerateChannelString(char *pString, const uint8_t Channel); void UI_GenerateChannelString(char *pString, const uint8_t Channel);
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const 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);
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, bool bCentered); void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
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_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero); void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
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);

View File

@ -36,11 +36,11 @@ static void Render(void)
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
strcpy(String, "LOCK"); strcpy(String, "LOCK");
UI_PrintString(String, 0, 127, 1, 10, true); UI_PrintString(String, 0, 127, 1, 10);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
String[i] = (gInputBox[i] == 10) ? '-' : '*'; String[i] = (gInputBox[i] == 10) ? '-' : '*';
String[6] = 0; String[6] = 0;
UI_PrintString(String, 0, 127, 3, 12, true); UI_PrintString(String, 0, 127, 3, 12);
ST7565_BlitStatusLine(); ST7565_BlitStatusLine();
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

181
ui/main.c
View File

@ -30,15 +30,16 @@
void UI_DisplayMain(void) void UI_DisplayMain(void)
{ {
char String[16]; const unsigned int display_width = 128;
unsigned int vfo_num; char String[16];
unsigned int vfo_num;
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
if (gEeprom.KEY_LOCK && gKeypadLocked) if (gEeprom.KEY_LOCK && gKeypadLocked)
{ {
UI_PrintString("Long Press #", 0, 127, 1, 8, true); UI_PrintString("Long press #", 0, display_width - 1, 1, 8);
UI_PrintString("To Unlock", 0, 127, 3, 8, true); UI_PrintString("to unlock", 0, display_width - 1, 3, 8);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return; return;
} }
@ -51,18 +52,17 @@ void UI_DisplayMain(void)
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
uint8_t Channel = gEeprom.TX_CHANNEL; uint8_t Channel = gEeprom.TX_CHANNEL;
bool bIsSameVfo = !!(Channel == vfo_num); bool bIsSameVfo = !!(Channel == vfo_num);
uint8_t Line = (vfo_num == 0) ? 0 : 4; uint8_t Line = (vfo_num == 0) ? 0 : 4;
uint8_t *pLine0 = gFrameBuffer[Line + 0]; uint8_t *pLine0 = gFrameBuffer[Line + 0];
uint8_t *pLine1 = gFrameBuffer[Line + 1]; uint8_t *pLine1 = gFrameBuffer[Line + 1];
uint32_t frequency_Hz = 0;
if (single_vfo) if (single_vfo)
{ // we're in single VFO mode { // we're in single VFO mode - screen is dedicated to just one VFO
if (!bIsSameVfo) if (!bIsSameVfo)
continue; // skip the unused vfo .. screen is dedicated to just a single VFO continue; // skip the unused vfo
//Line = 1; //Line = 1;
//pLine0 = gFrameBuffer[Line + 0]; //pLine0 = gFrameBuffer[Line + 0];
@ -93,7 +93,7 @@ void UI_DisplayMain(void)
} }
else else
sprintf(String, ">%s", gDTMF_InputBox); sprintf(String, ">%s", gDTMF_InputBox);
UI_PrintString(String, 2, 127, vfo_num * 3, 8, false); UI_PrintString(String, 2, 0, vfo_num * 3, 8);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (!gDTMF_InputMode) if (!gDTMF_InputMode)
@ -108,7 +108,7 @@ void UI_DisplayMain(void)
if (gDTMF_IsTx) if (gDTMF_IsTx)
sprintf(String, ">%s", gDTMF_String); sprintf(String, ">%s", gDTMF_String);
} }
UI_PrintString(String, 2, 127, 2 + (vfo_num * 3), 8, false); UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
continue; continue;
} }
@ -116,14 +116,16 @@ void UI_DisplayMain(void)
// highlight the selected/used VFO with a marker // highlight the selected/used VFO with a marker
if (!single_vfo && bIsSameVfo) if (!single_vfo && bIsSameVfo)
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
//else
// memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
else else
if (!single_vfo) if (!single_vfo)
{ // highlight the selected/used VFO with a marker { // highlight the selected/used VFO with a marker
if (bIsSameVfo) if (bIsSameVfo)
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
//else else
//memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
uint32_t SomeValue = 0; uint32_t SomeValue = 0;
@ -148,7 +150,7 @@ void UI_DisplayMain(void)
} }
} }
else else
{ // show the RX symbol { // receiving .. show the RX symbol
SomeValue = 2; SomeValue = 2;
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num) if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX)); memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX));
@ -157,29 +159,32 @@ void UI_DisplayMain(void)
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ // channel mode { // channel mode
// show the memory symbol const unsigned int x = 2;
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
// show the memory channel symbol
memcpy(pLine1 + x, BITMAP_M, sizeof(BITMAP_M));
// show the memory channel number // show the memory channel number
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String);
else else
memcpy(String + 5, gInputBox, 3); memcpy(String + 5, gInputBox, 3);
UI_DisplaySmallDigits(3, String + 5, 10, Line + 1); UI_DisplaySmallDigits(3, String + 5, x + sizeof(BITMAP_M), Line + 1);
} }
else else
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ {
const unsigned int x = 2; // was 14
// show the frequency band number // show the frequency band number
char c; char c;
memcpy(pLine1 + 14, BITMAP_F, sizeof(BITMAP_F)); memcpy(pLine1 + x, BITMAP_FB, sizeof(BITMAP_FB));
c = (gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST) + 1; c = (gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST) + 1;
UI_DisplaySmallDigits(1, &c, 22, Line + 1); UI_DisplaySmallDigits(1, &c, x + sizeof(BITMAP_FB), Line + 1);
} }
else else
{ {
// show the 'N' narrow band symbol // show the 'N' narrow band symbol - why do we do that here ?
memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); //memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
{ {
@ -193,6 +198,8 @@ void UI_DisplayMain(void)
UI_DisplaySmallDigits(2, String + 6, 15, Line + 1); UI_DisplaySmallDigits(2, String + 6, 15, Line + 1);
} }
// ************
uint8_t State = VfoState[vfo_num]; uint8_t State = VfoState[vfo_num];
#ifndef DISABLE_ALARM #ifndef DISABLE_ALARM
@ -206,12 +213,14 @@ void UI_DisplayMain(void)
if (State != VFO_STATE_NORMAL) if (State != VFO_STATE_NORMAL)
{ {
uint8_t Width = 10; //uint8_t Width = 10;
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
switch (State) switch (State)
{ {
//case VFO_STATE_NORMAL:
// break;
case VFO_STATE_BUSY: case VFO_STATE_BUSY:
strcpy(String, "BUSY"); strcpy(String, "BUSY");
//Width = 15; //Width = 15;
@ -230,15 +239,14 @@ void UI_DisplayMain(void)
break; break;
case VFO_STATE_VOLTAGE_HIGH: case VFO_STATE_VOLTAGE_HIGH:
sprintf(String, "VOLT HIGH"); sprintf(String, "VOLT HIGH");
Width = 8; //Width = 8;
break; break;
} }
#if 0 #if 0
UI_PrintString(String, 31, 111, Line, Width, true); UI_PrintString(String, 31, 111, Line, Width); // centered text
#else #else
(void)Width; UI_PrintString(String, 34, 0, Line, 8); // left aligned text
UI_PrintString(String, 31, 111, Line, 8, false);
#endif #endif
} }
else else
@ -250,16 +258,16 @@ void UI_DisplayMain(void)
} }
else else
{ {
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) uint32_t frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
{ // channel mode# if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
}
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency; if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
if (gCurrentFunction == FUNCTION_TRANSMIT) { // channel mode
{ // transmitting
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
}
{ // show the scanlist symbols { // show the scanlist symbols
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
@ -281,15 +289,13 @@ void UI_DisplayMain(void)
#else #else
// show the frequency in the main font // show the frequency in the main font
sprintf(String, "%9.5f", frequency_Hz * 0.00001); sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintString(String, 31, 112, Line, 8, true); UI_PrintString(String, 31, 112, Line, 8);
#endif #endif
frequency_Hz = 0;
break; break;
case MDF_CHANNEL: // show the channel number case MDF_CHANNEL: // show the channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1); sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, Line, 8, true); UI_PrintString(String, 31, 112, Line, 8);
frequency_Hz = 0; frequency_Hz = 0;
break; break;
@ -297,13 +303,12 @@ 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)
{ // no channel name, show the channel number instead { // no channel name, show the channel number instead
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1); sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, Line, 8, true); UI_PrintString(String, 31, 112, Line, 8);
} }
else else
{ // channel name { // channel name
UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, Line, 8, true); UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, Line, 8);
} }
frequency_Hz = 0;
break; break;
#ifdef CHAN_NAME_FREQ #ifdef CHAN_NAME_FREQ
@ -311,14 +316,24 @@ 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)
{ // no channel name, show channel number instead { // no channel name, show channel number instead
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, Line, false); UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line);
} }
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, Line, false); UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line);
} }
// show the channel frequency below the channel number/name
#if 1
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequencySmall(String, 31 + 8, Line + 1, false);
#else
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintStringSmall(String, 31 + 8, 0, Line + 1);
#endif
break; break;
#endif #endif
} }
@ -326,14 +341,6 @@ void UI_DisplayMain(void)
else else
{ // frequency mode { // frequency mode
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
}
#ifndef DISABLE_BIG_FREQ #ifndef DISABLE_BIG_FREQ
NUMBER_ToDigits(frequency_Hz, String); // 8 digits NUMBER_ToDigits(frequency_Hz, String); // 8 digits
// show the main large frequency digits // show the main large frequency digits
@ -343,14 +350,14 @@ void UI_DisplayMain(void)
#else #else
// show the frequency in the main font // show the frequency in the main font
sprintf(String, "%9.5f", frequency_Hz * 0.00001); sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintString(String, 31, 112, Line, 8, true); UI_PrintString(String, 38, 112, Line, 8);
#endif #endif
frequency_Hz = 0;
} }
} }
} }
// ************
{ // show the TX/RX level { // show the TX/RX level
uint8_t Level = 0; uint8_t Level = 0;
@ -379,38 +386,41 @@ void UI_DisplayMain(void)
if (Level >= 1) if (Level >= 1)
{ {
memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); memcpy(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); memcpy(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (Level >= 2) if (Level >= 2)
memcpy(pLine1 + 128 + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); memcpy(pLine1 + display_width + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (Level >= 3) if (Level >= 3)
memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); memcpy(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (Level >= 4) if (Level >= 4)
memcpy(pLine1 + 128 + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); memcpy(pLine1 + display_width + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (Level >= 5) if (Level >= 5)
memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); memcpy(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 6) if (Level >= 6)
memcpy(pLine1 + 128 + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); memcpy(pLine1 + display_width + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
} }
} }
// ************
if (gEeprom.VfoInfo[vfo_num].IsAM) if (gEeprom.VfoInfo[vfo_num].IsAM)
{ // show the AM symbol { // show the AM symbol
memcpy(pLine1 + 128 + 27, BITMAP_AM, sizeof(BITMAP_AM)); memcpy(pLine1 + display_width + 27, BITMAP_AM, sizeof(BITMAP_AM));
} }
else else
{ // show the CTCSS or DCS symbol { // show the CTCSS or DCS symbol
const FREQ_Config_t *pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX; const FREQ_Config_t *pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
switch (pConfig->CodeType) switch (pConfig->CodeType)
{ {
default:
case CODE_TYPE_OFF:
break;
case CODE_TYPE_CONTINUOUS_TONE: // CTCSS case CODE_TYPE_CONTINUOUS_TONE: // CTCSS
memcpy(pLine1 + 128 + 27, BITMAP_CT, sizeof(BITMAP_CT)); memcpy(pLine1 + display_width + 27, BITMAP_CT, sizeof(BITMAP_CT));
break; break;
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL: // DCS case CODE_TYPE_REVERSE_DIGITAL: // DCS
memcpy(pLine1 + 128 + 24, BITMAP_DCS, sizeof(BITMAP_DCS)); memcpy(pLine1 + display_width + 24, BITMAP_DCS, sizeof(BITMAP_DCS));
break;
default:
break; break;
} }
} }
@ -418,52 +428,39 @@ void UI_DisplayMain(void)
switch (gEeprom.VfoInfo[vfo_num].OUTPUT_POWER) switch (gEeprom.VfoInfo[vfo_num].OUTPUT_POWER)
{ // show the TX power level symbol { // show the TX power level symbol
case OUTPUT_POWER_LOW: case OUTPUT_POWER_LOW:
memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow)); memcpy(pLine1 + display_width + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow));
break; break;
case OUTPUT_POWER_MID: case OUTPUT_POWER_MID:
memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid)); memcpy(pLine1 + display_width + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid));
break; break;
case OUTPUT_POWER_HIGH: case OUTPUT_POWER_HIGH:
memcpy(pLine1 + 128 + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh)); memcpy(pLine1 + display_width + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh));
break; break;
} }
if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency) if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency)
{ // show the TX offset symbol { // show the TX offset symbol
if (gEeprom.VfoInfo[vfo_num].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_ADD) if (gEeprom.VfoInfo[vfo_num].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_ADD)
memcpy(pLine1 + 128 + 54, BITMAP_Add, sizeof(BITMAP_Add)); memcpy(pLine1 + display_width + 54, BITMAP_Add, sizeof(BITMAP_Add));
if (gEeprom.VfoInfo[vfo_num].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_SUB) if (gEeprom.VfoInfo[vfo_num].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_SUB)
memcpy(pLine1 + 128 + 54, BITMAP_Sub, sizeof(BITMAP_Sub)); memcpy(pLine1 + display_width + 54, BITMAP_Sub, sizeof(BITMAP_Sub));
} }
// show the TX/RX reverse symbol // show the TX/RX reverse symbol
if (gEeprom.VfoInfo[vfo_num].FrequencyReverse) if (gEeprom.VfoInfo[vfo_num].FrequencyReverse)
memcpy(pLine1 + 128 + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode)); memcpy(pLine1 + display_width + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode));
// show the narrow band symbol // show the narrow band symbol
if (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW) if (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
memcpy(pLine1 + 128 + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); memcpy(pLine1 + display_width + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
// show the DTMF decoding symbol // show the DTMF decoding symbol
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED) if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
memcpy(pLine1 + 128 + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF)); memcpy(pLine1 + display_width + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF));
// show the audio scramble symbol // show the audio scramble symbol
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE && gSetting_ScrambleEnable) if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE && gSetting_ScrambleEnable)
memcpy(pLine1 + 128 + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble)); memcpy(pLine1 + display_width + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble));
#ifdef CHAN_NAME_FREQ
if (frequency_Hz > 0)
{ // show the channel frequency below the channel number/name
#if 1
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequencySmall(String, 31 + 8, Line + 1, false);
#else
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintStringSmall(String, 31 + 8, 0, Line + 1, false);
#endif
}
#endif
} }
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

View File

@ -270,7 +270,7 @@ void UI_DisplayMenu(void)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (gMenuCursor || i) if (gMenuCursor || i)
if ((gMenuListCount - 1) != gMenuCursor || i != 2) if ((gMenuListCount - 1) != gMenuCursor || i != 2)
UI_PrintString(MenuList[gMenuCursor + i - 1], 0, 127, i * 2, 8, false); UI_PrintString(MenuList[gMenuCursor + i - 1], 0, 0, i * 2, 8);
for (i = 0; i < 48; i++) for (i = 0; i < 48; i++)
{ {
@ -539,38 +539,38 @@ void UI_DisplayMenu(void)
if (gMenuCursor == MENU_AM) if (gMenuCursor == MENU_AM)
{ // the radio doesn't really do AM { // the radio doesn't really do AM
UI_PrintString(String, 50, 127, 1, 8, true); UI_PrintString(String, 50, 127, 1, 8);
if (gSubMenuSelection > 0) if (gSubMenuSelection > 0)
{ {
UI_PrintString("not", 50, 127, 3, 8, true); UI_PrintString("not", 50, 127, 3, 8);
UI_PrintString("really", 50, 127, 5, 8, true); UI_PrintString("really", 50, 127, 5, 8);
} }
} }
else else
if (gMenuCursor == MENU_VOL) if (gMenuCursor == MENU_VOL)
{ // 2nd text line .. percentage { // 2nd text line .. percentage
UI_PrintString(String, 50, 127, 1, 8, true); UI_PrintString(String, 50, 127, 1, 8);
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, 3, 8, true); UI_PrintString(String, 50, 127, 3, 8);
} }
else else
if (gMenuCursor == MENU_OFFSET) if (gMenuCursor == MENU_OFFSET)
{ {
UI_PrintString(String, 50, 127, 1, 8, true); UI_PrintString(String, 50, 127, 1, 8);
UI_PrintString("MHz", 50, 127, 3, 8, true); UI_PrintString("MHz", 50, 127, 3, 8);
} }
else else
{ {
UI_PrintString(String, 50, 127, 2, 8, true); UI_PrintString(String, 50, 127, 2, 8);
} }
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 { // 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);
} }
else else
if ((gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && !gAskForConfirmation) if ((gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && !gAskForConfirmation)
@ -599,27 +599,27 @@ void UI_DisplayMenu(void)
s[i] = 0; s[i] = 0;
} }
} }
UI_PrintString(s, 50, 127, 4, 8, true); UI_PrintString(s, 50, 127, 4, 8);
} }
} }
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);
if (gMenuCursor == MENU_UPCODE) if (gMenuCursor == MENU_UPCODE)
if (strlen(gEeprom.DTMF_UP_CODE) > 8) if (strlen(gEeprom.DTMF_UP_CODE) > 8)
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, 50, 127, 4, 8, true); UI_PrintString(gEeprom.DTMF_UP_CODE + 8, 50, 127, 4, 8);
if (gMenuCursor == MENU_DWCODE) if (gMenuCursor == MENU_DWCODE)
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8) if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, 50, 127, 4, 8, true); UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, 50, 127, 4, 8);
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid) if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
{ {
Contact[11] = 0; Contact[11] = 0;
memcpy(&gDTMF_ID, Contact + 8, 4); memcpy(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%s", Contact + 8); sprintf(String, "ID:%s", Contact + 8);
UI_PrintString(String, 50, 127, 4, 8, true); UI_PrintString(String, 50, 127, 4, 8);
} }
if (gMenuCursor == MENU_R_CTCS || if (gMenuCursor == MENU_R_CTCS ||
@ -645,22 +645,22 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i]) if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i])
{ {
UI_PrintString(String, 50, 127, 2, 8, 1); UI_PrintString(String, 50, 127, 2, 8);
} }
else else
{ {
UI_PrintString(String, 50, 127, 0, 8, 1); UI_PrintString(String, 50, 127, 0, 8);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i]))
{ {
sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1); sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, 50, 127, 2, 8, 1); UI_PrintString(String, 50, 127, 2, 8);
} }
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i]))
{ {
sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1); sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, 50, 127, 4, 8, 1); UI_PrintString(String, 50, 127, 4, 8);
} }
} }
} }

View File

@ -38,7 +38,7 @@ void UI_DisplayScanner(void)
} else { } else {
sprintf(String, "FREQ:**.*****"); sprintf(String, "FREQ:**.*****");
} }
UI_PrintString(String, 2, 127, 1, 8, 0); UI_PrintString(String, 2, 0, 1, 8);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) { if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
@ -49,7 +49,7 @@ void UI_DisplayScanner(void)
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]); sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
} }
UI_PrintString(String, 2, 127, 3, 8, 0); UI_PrintString(String, 2, 0, 3, 8);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gScannerEditState == 2) { if (gScannerEditState == 2) {
@ -74,7 +74,8 @@ void UI_DisplayScanner(void)
bCentered = 0; bCentered = 0;
} }
UI_PrintString(String, Start, 127, 5, 8, bCentered); UI_PrintString(String, Start, bCentered ? 127 : 0, 5, 8);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }

View File

@ -60,10 +60,9 @@ void UI_DisplayWelcome(void)
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16); EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
} }
// UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered); UI_PrintString(WelcomeString0, 0, 127, 0, 10);
UI_PrintString(WelcomeString0, 0, 127, 0, 10, true); UI_PrintString(WelcomeString1, 0, 127, 2, 10);
UI_PrintString(WelcomeString1, 0, 127, 2, 10, true); UI_PrintString(Version, 0, 127, 5, 10);
UI_PrintString(Version, 0, 127, 5, 10, true);
ST7565_BlitStatusLine(); ST7565_BlitStatusLine();
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();