0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Live DTMF decoder display tidy up

This commit is contained in:
OneOfEleven
2023-09-17 09:54:24 +01:00
parent d1bbe69b91
commit 78c62d5489
21 changed files with 191 additions and 157 deletions

View File

@ -76,8 +76,8 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
{
const unsigned int Index = pString[i] - ' ';
const unsigned int ofs = (unsigned int)Start + (i * Width);
memcpy(gFrameBuffer[Line + 0] + ofs, &gFontBig[Index][0], 8);
memcpy(gFrameBuffer[Line + 1] + ofs, &gFontBig[Index][8], 7);
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[Index][0], 8);
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[Index][8], 7);
}
}
}
@ -99,7 +99,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{
const unsigned int Index = (unsigned int)pString[i] - 32;
if (Index < ARRAY_SIZE(gFontSmall))
memcpy(pFb + (i * char_spacing), &gFontSmall[Index], char_width);
memmove(pFb + (i * char_spacing), &gFontSmall[Index], char_width);
}
}
}
@ -119,8 +119,8 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{
bCanDisplay = true;
memcpy(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width);
memmove(pFb0, gFontBigDigits[Digit], char_width);
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
}
else
if (bFlag)
@ -141,8 +141,8 @@ void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDispla
while (i < 6)
{
const unsigned int Digit = pDigits[i++];
memcpy(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width);
memmove(pFb0, gFontBigDigits[Digit], char_width);
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
pFb0 += char_width;
pFb1 += char_width;
}
@ -162,7 +162,7 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{
bCanDisplay = true;
memcpy(pFb, gFontSmallDigits[Digit], char_width);
memmove(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width;
}
}
@ -178,7 +178,7 @@ void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bD
while (i < 8)
{
const unsigned int Digit = pDigits[i++];
memcpy(pFb, gFontSmallDigits[Digit], char_width);
memmove(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width;
}
}
@ -196,7 +196,7 @@ void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x,
display = true;
if (display && c < ARRAY_SIZE(gFontSmallDigits))
{
memcpy(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
memmove(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
xx += char_width;
}
}

View File

@ -54,6 +54,10 @@ void UI_DisplayMain(void)
const bool single_vfo = false;
// #endif
#ifdef ENABLE_DTMF_DECODER
bool show_dtmf_rx = true;
#endif
for (vfo_num = 0; vfo_num < 2; vfo_num++)
{
uint8_t Channel = gEeprom.TX_CHANNEL;
@ -112,24 +116,28 @@ void UI_DisplayMain(void)
}
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
#ifdef ENABLE_DTMF_DECODER
show_dtmf_rx = false;
#endif
continue;
}
// highlight the selected/used VFO with a marker
if (!single_vfo && bIsSameVfo)
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
memmove(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
memmove(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));
memmove(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
memmove(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
}
uint32_t SomeValue = 0;
@ -167,7 +175,7 @@ void UI_DisplayMain(void)
if (!inputting)
NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number
else
memcpy(String + 5, gInputBox, 3); // show the input text
memmove(String + 5, gInputBox, 3); // show the input text
UI_PrintStringSmall("M", x, 0, Line + 1);
UI_DisplaySmallDigits(3, String + 5, x + 7, Line + 1, inputting);
}
@ -234,9 +242,9 @@ void UI_DisplayMain(void)
{ // show the scanlist symbols
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (Attributes & MR_CH_SCANLIST1)
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
memmove(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
if (Attributes & MR_CH_SCANLIST2)
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
memmove(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
}
switch (gEeprom.CHANNEL_DISPLAY_MODE)
@ -270,7 +278,7 @@ void UI_DisplayMain(void)
else
{ // channel name
memset(String, 0, sizeof(String));
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 10);
memmove(String, gEeprom.VfoInfo[vfo_num].Name, 10);
}
UI_PrintString(String, 31, 112, Line, 8);
break;
@ -285,7 +293,7 @@ void UI_DisplayMain(void)
else
{ // channel name
memset(String, 0, sizeof(String));
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 10);
memmove(String, gEeprom.VfoInfo[vfo_num].Name, 10);
}
UI_PrintStringSmall(String, 31 + 8, 0, Line);
@ -336,18 +344,18 @@ void UI_DisplayMain(void)
if (Level >= 1)
{
memcpy(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memcpy(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
memmove(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memmove(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (Level >= 2)
memcpy(pLine1 + display_width + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
memmove(pLine1 + display_width + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (Level >= 3)
memcpy(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
memmove(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (Level >= 4)
memcpy(pLine1 + display_width + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
memmove(pLine1 + display_width + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (Level >= 5)
memcpy(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
memmove(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 6)
memcpy(pLine1 + display_width + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
memmove(pLine1 + display_width + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
}
}
@ -404,7 +412,7 @@ void UI_DisplayMain(void)
}
#ifdef ENABLE_DTMF_DECODER
if (gDTMF_ReceivedSaved[0] >= 32)
if (show_dtmf_rx && gDTMF_ReceivedSaved[0] >= 32)
{ // show the incoming DTMF live on-screen
UI_PrintStringSmall(gDTMF_ReceivedSaved, 8, 0, 3);
}

View File

@ -302,7 +302,7 @@ void UI_DisplayMenu(void)
#endif
if (gIsInSubMenu)
memcpy(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
memmove(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
memset(String, 0, sizeof(String));
@ -523,7 +523,7 @@ void UI_DisplayMenu(void)
if (!gIsDtmfContactValid)
strcpy(String, "NULL");
else
memcpy(String, Contact, 8);
memmove(String, Contact, 8);
break;
case MENU_PONMSG:
@ -650,7 +650,7 @@ void UI_DisplayMenu(void)
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
{
Contact[11] = 0;
memcpy(&gDTMF_ID, Contact + 8, 4);
memmove(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%s", Contact + 8);
UI_PrintString(String, 50, 127, 4, 8);
}

View File

@ -53,19 +53,19 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
}
else
{
memcpy(pLine, BITMAP_Antenna, 5);
memmove(pLine, BITMAP_Antenna, 5);
if (RssiLevel >= 2)
memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (RssiLevel >= 3)
memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
memmove(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (RssiLevel >= 4)
memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
memmove(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (RssiLevel >= 5)
memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
memmove(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (RssiLevel >= 6)
memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
memmove(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (RssiLevel >= 7)
memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
}
ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode);

View File

@ -34,11 +34,11 @@ void UI_DisplayStatus(const bool test_display)
memset(gStatusLine, 0, sizeof(gStatusLine));
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
memcpy(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
memmove(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
#ifdef ENABLE_NOAA
if (gIsNoaaMode || test_display)
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
memmove(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
#endif
if (gSetting_KILLED || test_display)
@ -46,46 +46,46 @@ void UI_DisplayStatus(const bool test_display)
#ifdef ENABLE_FMRADIO
else
if (gFmRadioMode || test_display)
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
memmove(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
#endif
#ifdef ENABLE_VOICE
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
memmove(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
#endif
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
memmove(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
memcpy(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB));
memmove(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB));
if (gEeprom.VOX_SWITCH || test_display)
memcpy(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
memmove(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
if (gEeprom.KEY_LOCK || test_display)
memcpy(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
memmove(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
else
if (gWasFKeyPressed)
memcpy(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
memmove(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
if (gChargingWithTypeC || test_display)
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
memmove(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
if (gBatteryDisplayLevel >= 5 || test_display)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
memmove(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
else
if (gBatteryDisplayLevel >= 4)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
memmove(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
else
if (gBatteryDisplayLevel >= 3)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
memmove(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
else
if (gBatteryDisplayLevel >= 2)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
memmove(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
else
if (gLowBatteryBlink == 1)
memcpy(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
memmove(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
ST7565_BlitStatusLine();
}