diff --git a/app/main.c b/app/main.c index d255572..8630fd0 100644 --- a/app/main.c +++ b/app/main.c @@ -99,10 +99,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) NUMBER_Get(gInputBox, &Frequency); - if (gSetting_350EN || (4999990 < (Frequency - 35000000))) + if (gSetting_350EN || Frequency < 35000000 || Frequency >= 40000000) { unsigned int i; - for (i = 0; i < 7; i++) { 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 gAnotherVoiceID = (VOICE_ID_t)Key; #endif + if (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; SETTINGS_SaveVfoIndices(); + RADIO_ConfigureChannel(Vfo, 2); } Frequency += 75; - gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep( - Frequency, - gTxVfo->StepFrequency, - gLowerLimitFrequencyBandTable[gTxVfo->Band]); + gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, gLowerLimitFrequencyBandTable[gTxVfo->Band]); gRequestSaveChannel = 1; return; diff --git a/bitmaps.c b/bitmaps.c index e0783d9..a40c4dd 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -408,7 +408,7 @@ const uint8_t BITMAP_M[] = 0b01111111 }; -const uint8_t BITMAP_F[] = +const uint8_t BITMAP_FB[] = { 0b00000000, 0b01111111, @@ -417,7 +417,16 @@ const uint8_t BITMAP_F[] = 0b00001001, 0b00001001, 0b00001001, - 0b00000001 + 0b00000001, + + 0b00000000, + 0b01111111, + 0b01001001, + 0b01001001, + 0b01001001, + 0b01001001, + 0b01001001, + 0b00110110 }; const uint8_t BITMAP_ReverseMode[] = diff --git a/bitmaps.h b/bitmaps.h index 5695786..7fa284a 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -47,7 +47,7 @@ extern const uint8_t BITMAP_TX[16]; extern const uint8_t BITMAP_RX[16]; 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]; diff --git a/firmware b/firmware index 7763c96..3d80b94 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index 882bd6d..fe3f4a4 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 26effc7..664c119 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/ui/aircopy.c b/ui/aircopy.c index b584f52..85ba8ab 100644 --- a/ui/aircopy.c +++ b/ui/aircopy.c @@ -40,7 +40,7 @@ void UI_DisplayAircopy(void) strcpy(String, "AIR COPY"); else strcpy(String, "AIR COPY(CMP)"); - UI_PrintString(String, 2, 127, 0, 8, true); + UI_PrintString(String, 2, 127, 0, 8); if (gInputBoxIndex == 0) { @@ -57,7 +57,7 @@ void UI_DisplayAircopy(void) else if (gAirCopyIsSendMode == 1) sprintf(String, "SND:%d", gAirCopyBlockNumber); - UI_PrintString(String, 2, 127, 4, 8, true); + UI_PrintString(String, 2, 127, 4, 8); ST7565_BlitFullScreen(); } diff --git a/ui/fmradio.c b/ui/fmradio.c index 851a010..f637cd5 100644 --- a/ui/fmradio.c +++ b/ui/fmradio.c @@ -35,7 +35,7 @@ void UI_DisplayFM(void) memset(String, 0, sizeof(String)); strcpy(String, "FM"); - UI_PrintString(String, 0, 127, 0, 12, true); + UI_PrintString(String, 0, 127, 0, 12); memset(String, 0, sizeof(String)); 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)); if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) { @@ -84,7 +84,7 @@ void UI_DisplayFM(void) 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(); } diff --git a/ui/helper.c b/ui/helper.c index 4d7ab48..6cc64f3 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -62,12 +62,12 @@ void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uin 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 Length = strlen(pString); - if (bCentered) + if (End > Start) Start += (((End - Start) - (Length * Width)) + 1) / 2; 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); size_t i; - if (bCentered) + if (End > Start) Start += (((End - Start) - (Length * 8)) + 1) / 2; #if 1 diff --git a/ui/helper.h b/ui/helper.h index 13a0b9f..dbd4353 100644 --- a/ui/helper.h +++ b/ui/helper.h @@ -22,8 +22,8 @@ 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_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, 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); 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_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y); diff --git a/ui/lock.c b/ui/lock.c index 4856f69..8b0f27a 100644 --- a/ui/lock.c +++ b/ui/lock.c @@ -36,11 +36,11 @@ static void Render(void) memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); strcpy(String, "LOCK"); - UI_PrintString(String, 0, 127, 1, 10, true); + UI_PrintString(String, 0, 127, 1, 10); for (i = 0; i < 6; i++) String[i] = (gInputBox[i] == 10) ? '-' : '*'; String[6] = 0; - UI_PrintString(String, 0, 127, 3, 12, true); + UI_PrintString(String, 0, 127, 3, 12); ST7565_BlitStatusLine(); ST7565_BlitFullScreen(); diff --git a/ui/main.c b/ui/main.c index d0a7d80..1d86942 100644 --- a/ui/main.c +++ b/ui/main.c @@ -30,15 +30,16 @@ void UI_DisplayMain(void) { - char String[16]; - unsigned int vfo_num; + const unsigned int display_width = 128; + char String[16]; + unsigned int vfo_num; memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); if (gEeprom.KEY_LOCK && gKeypadLocked) { - UI_PrintString("Long Press #", 0, 127, 1, 8, true); - UI_PrintString("To Unlock", 0, 127, 3, 8, true); + UI_PrintString("Long press #", 0, display_width - 1, 1, 8); + UI_PrintString("to unlock", 0, display_width - 1, 3, 8); ST7565_BlitFullScreen(); return; } @@ -51,18 +52,17 @@ void UI_DisplayMain(void) for (vfo_num = 0; vfo_num < 2; vfo_num++) { - uint8_t Channel = gEeprom.TX_CHANNEL; - bool bIsSameVfo = !!(Channel == vfo_num); - uint8_t Line = (vfo_num == 0) ? 0 : 4; - uint8_t *pLine0 = gFrameBuffer[Line + 0]; - uint8_t *pLine1 = gFrameBuffer[Line + 1]; - uint32_t frequency_Hz = 0; + uint8_t Channel = gEeprom.TX_CHANNEL; + bool bIsSameVfo = !!(Channel == vfo_num); + uint8_t Line = (vfo_num == 0) ? 0 : 4; + uint8_t *pLine0 = gFrameBuffer[Line + 0]; + uint8_t *pLine1 = gFrameBuffer[Line + 1]; if (single_vfo) - { // we're in single VFO mode + { // we're in single VFO mode - screen is dedicated to just one VFO if (!bIsSameVfo) - continue; // skip the unused vfo .. screen is dedicated to just a single VFO + continue; // skip the unused vfo //Line = 1; //pLine0 = gFrameBuffer[Line + 0]; @@ -93,7 +93,7 @@ void UI_DisplayMain(void) } else 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)); if (!gDTMF_InputMode) @@ -108,7 +108,7 @@ void UI_DisplayMain(void) if (gDTMF_IsTx) 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; } @@ -116,14 +116,16 @@ void UI_DisplayMain(void) // highlight the selected/used VFO with a marker if (!single_vfo && bIsSameVfo) memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); + //else + // memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); } else if (!single_vfo) { // highlight the selected/used VFO with a marker if (bIsSameVfo) memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); - //else - //memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); + else + memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); } uint32_t SomeValue = 0; @@ -148,7 +150,7 @@ void UI_DisplayMain(void) } } else - { // show the RX symbol + { // receiving .. show the RX symbol SomeValue = 2; if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num) memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX)); @@ -157,29 +159,32 @@ void UI_DisplayMain(void) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode - // show the memory symbol - memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M)); + const unsigned int x = 2; + + // show the memory channel symbol + memcpy(pLine1 + x, BITMAP_M, sizeof(BITMAP_M)); // show the memory channel number if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); else 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 if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { + const unsigned int x = 2; // was 14 // show the frequency band number 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; - UI_DisplaySmallDigits(1, &c, 22, Line + 1); + UI_DisplaySmallDigits(1, &c, x + sizeof(BITMAP_FB), Line + 1); } else { - // show the 'N' narrow band symbol - memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); + // show the 'N' narrow band symbol - why do we do that here ? + //memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) { @@ -193,6 +198,8 @@ void UI_DisplayMain(void) UI_DisplaySmallDigits(2, String + 6, 15, Line + 1); } + // ************ + uint8_t State = VfoState[vfo_num]; #ifndef DISABLE_ALARM @@ -206,12 +213,14 @@ void UI_DisplayMain(void) if (State != VFO_STATE_NORMAL) { - uint8_t Width = 10; + //uint8_t Width = 10; memset(String, 0, sizeof(String)); switch (State) { + //case VFO_STATE_NORMAL: + // break; case VFO_STATE_BUSY: strcpy(String, "BUSY"); //Width = 15; @@ -230,15 +239,14 @@ void UI_DisplayMain(void) break; case VFO_STATE_VOLTAGE_HIGH: sprintf(String, "VOLT HIGH"); - Width = 8; + //Width = 8; break; } #if 0 - UI_PrintString(String, 31, 111, Line, Width, true); + UI_PrintString(String, 31, 111, Line, Width); // centered text #else - (void)Width; - UI_PrintString(String, 31, 111, Line, 8, false); + UI_PrintString(String, 34, 0, Line, 8); // left aligned text #endif } else @@ -250,17 +258,17 @@ void UI_DisplayMain(void) } else { - if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) - { // channel 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; - } + uint32_t 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; + } + if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) + { // channel mode + { // show the scanlist symbols const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; if (Attributes & MR_CH_SCANLIST1) @@ -281,15 +289,13 @@ void UI_DisplayMain(void) #else // show the frequency in the main font sprintf(String, "%9.5f", frequency_Hz * 0.00001); - UI_PrintString(String, 31, 112, Line, 8, true); + UI_PrintString(String, 31, 112, Line, 8); #endif - - frequency_Hz = 0; break; case MDF_CHANNEL: // show the channel number 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; break; @@ -297,13 +303,12 @@ void UI_DisplayMain(void) if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF) { // no channel name, show the channel number instead 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 { // 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; #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) { // no channel name, show channel number instead 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 { // channel name memset(String, 0, sizeof(String)); 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; #endif } @@ -326,14 +341,6 @@ void UI_DisplayMain(void) else { // 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 NUMBER_ToDigits(frequency_Hz, String); // 8 digits // show the main large frequency digits @@ -343,14 +350,14 @@ void UI_DisplayMain(void) #else // show the frequency in the main font sprintf(String, "%9.5f", frequency_Hz * 0.00001); - UI_PrintString(String, 31, 112, Line, 8, true); + UI_PrintString(String, 38, 112, Line, 8); #endif - - frequency_Hz = 0; } } } + // ************ + { // show the TX/RX level uint8_t Level = 0; @@ -379,38 +386,41 @@ void UI_DisplayMain(void) if (Level >= 1) { - memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); - memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); + memcpy(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); + memcpy(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); 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) - memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); + memcpy(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); 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) - memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); + memcpy(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); 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) { // show the AM symbol - memcpy(pLine1 + 128 + 27, BITMAP_AM, sizeof(BITMAP_AM)); + memcpy(pLine1 + display_width + 27, BITMAP_AM, sizeof(BITMAP_AM)); } else { // show the CTCSS or DCS symbol const FREQ_Config_t *pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX; switch (pConfig->CodeType) { + default: + case CODE_TYPE_OFF: + break; 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; case CODE_TYPE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL: // DCS - memcpy(pLine1 + 128 + 24, BITMAP_DCS, sizeof(BITMAP_DCS)); - break; - default: + memcpy(pLine1 + display_width + 24, BITMAP_DCS, sizeof(BITMAP_DCS)); break; } } @@ -418,52 +428,39 @@ void UI_DisplayMain(void) switch (gEeprom.VfoInfo[vfo_num].OUTPUT_POWER) { // show the TX power level symbol case OUTPUT_POWER_LOW: - memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow)); + memcpy(pLine1 + display_width + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow)); break; case OUTPUT_POWER_MID: - memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid)); + memcpy(pLine1 + display_width + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid)); break; case OUTPUT_POWER_HIGH: - memcpy(pLine1 + 128 + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh)); + memcpy(pLine1 + display_width + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh)); break; } if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency) { // show the TX offset symbol 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) - 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 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 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 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 if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE && gSetting_ScrambleEnable) - memcpy(pLine1 + 128 + 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 + memcpy(pLine1 + display_width + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble)); } ST7565_BlitFullScreen(); diff --git a/ui/menu.c b/ui/menu.c index 3bfe237..b136962 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -270,7 +270,7 @@ void UI_DisplayMenu(void) for (i = 0; i < 3; i++) if (gMenuCursor || i) 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++) { @@ -539,38 +539,38 @@ void UI_DisplayMenu(void) if (gMenuCursor == MENU_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) { - UI_PrintString("not", 50, 127, 3, 8, true); - UI_PrintString("really", 50, 127, 5, 8, true); + UI_PrintString("not", 50, 127, 3, 8); + UI_PrintString("really", 50, 127, 5, 8); } } else if (gMenuCursor == MENU_VOL) { // 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 : (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, 3, 8, true); + UI_PrintString(String, 50, 127, 3, 8); } else if (gMenuCursor == MENU_OFFSET) { - UI_PrintString(String, 50, 127, 1, 8, true); - UI_PrintString("MHz", 50, 127, 3, 8, true); + UI_PrintString(String, 50, 127, 1, 8); + UI_PrintString("MHz", 50, 127, 3, 8); } 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) { // display confirmation strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!"); - UI_PrintString(String, 50, 127, 4, 8, true); + UI_PrintString(String, 50, 127, 4, 8); } else if ((gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && !gAskForConfirmation) @@ -599,27 +599,27 @@ void UI_DisplayMenu(void) 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) - UI_PrintString("SCAN", 50, 127, 4, 8, true); + UI_PrintString("SCAN", 50, 127, 4, 8); if (gMenuCursor == MENU_UPCODE) 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 (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) { Contact[11] = 0; memcpy(&gDTMF_ID, Contact + 8, 4); 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 || @@ -645,22 +645,22 @@ void UI_DisplayMenu(void) if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i]) { - UI_PrintString(String, 50, 127, 2, 8, 1); + UI_PrintString(String, 50, 127, 2, 8); } 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])) { 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])) { 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); } } } diff --git a/ui/scanner.c b/ui/scanner.c index a01dc02..c953774 100644 --- a/ui/scanner.c +++ b/ui/scanner.c @@ -38,7 +38,7 @@ void UI_DisplayScanner(void) } else { sprintf(String, "FREQ:**.*****"); } - UI_PrintString(String, 2, 127, 1, 8, 0); + UI_PrintString(String, 2, 0, 1, 8); memset(String, 0, sizeof(String)); if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) { @@ -49,7 +49,7 @@ void UI_DisplayScanner(void) 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)); if (gScannerEditState == 2) { @@ -74,7 +74,8 @@ void UI_DisplayScanner(void) bCentered = 0; } - UI_PrintString(String, Start, 127, 5, 8, bCentered); + UI_PrintString(String, Start, bCentered ? 127 : 0, 5, 8); + ST7565_BlitFullScreen(); } diff --git a/ui/welcome.c b/ui/welcome.c index 167a222..95f9756 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -60,10 +60,9 @@ void UI_DisplayWelcome(void) 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, true); - UI_PrintString(WelcomeString1, 0, 127, 2, 10, true); - UI_PrintString(Version, 0, 127, 5, 10, true); + UI_PrintString(WelcomeString0, 0, 127, 0, 10); + UI_PrintString(WelcomeString1, 0, 127, 2, 10); + UI_PrintString(Version, 0, 127, 5, 10); ST7565_BlitStatusLine(); ST7565_BlitFullScreen();