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

Channel frequency can be shown with name

This commit is contained in:
OneOfEleven
2023-09-10 05:49:39 +01:00
parent 5bc11d6674
commit 2d8c4787bf
16 changed files with 369 additions and 166 deletions

View File

@ -15,6 +15,7 @@
*/
#include <string.h>
#include "driver/st7565.h"
#include "external/printf/printf.h"
#include "font.h"
@ -77,47 +78,112 @@ 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)
{
const size_t Length = strlen(pString);
size_t i;
if (bCentered)
Start += (((End - Start) - (Length * 8)) + 1) / 2;
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
{
const unsigned int Index = ((unsigned int)pString[i] - 32) * 5;
if (Index < sizeof(gFont5x7))
{
const unsigned int ofs = (unsigned int)Start + (i * 8);
memcpy(gFrameBuffer[Line] + ofs, &gFont5x7[Index], 5);
}
}
}
}
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
{
unsigned int i;
uint8_t *pFb0 = gFrameBuffer[Y] + X;;
uint8_t *pFb1 = pFb0 + 128;
bool bCanDisplay = false;
for (i = 0; i < 3; i++)
const unsigned int char_width = 13;
uint8_t *pFb0 = gFrameBuffer[Y] + X;
uint8_t *pFb1 = pFb0 + 128;
bool bCanDisplay = false;
unsigned int i = 0;
// MHz
while (i < 3)
{
const uint8_t Digit = pDigits[i];
if (bDisplayLeadingZero || bCanDisplay || Digit)
const unsigned int Digit = pDigits[i++];
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{
bCanDisplay = true;
memcpy(pFb0 + (i * 13), gFontBigDigits[Digit] + 0, 13);
memcpy(pFb1 + (i * 13), gFontBigDigits[Digit] + 13, 13);
memcpy(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width);
}
else
if (bFlag)
{
pFb1 -= 6;
pFb0 -= 6;
pFb1 -= 6;
}
pFb0 += char_width;
pFb1 += char_width;
}
// decimal point
*pFb1 = 0x60; pFb0++; pFb1++;
*pFb1 = 0x60; pFb0++; pFb1++;
*pFb1 = 0x60; pFb0++; pFb1++;
// kHz
while (i < 6)
{
const unsigned int Digit = pDigits[i++];
memcpy(pFb0, gFontBigDigits[Digit], char_width);
memcpy(pFb1, gFontBigDigits[Digit] + char_width, char_width);
pFb0 += char_width;
pFb1 += char_width;
}
}
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
{
const unsigned int char_width = 7;
uint8_t *pFb = gFrameBuffer[Y] + X;
bool bCanDisplay = false;
unsigned int i = 0;
// MHz
while (i < 3)
{
const unsigned int Digit = pDigits[i++];
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
{
bCanDisplay = true;
memcpy(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width;
}
}
pFb1[0x27] = 0x60;
pFb1[0x28] = 0x60;
pFb1[0x29] = 0x60;
// decimal point
pFb++;
pFb++;
*pFb++ = 0x60;
*pFb++ = 0x60;
pFb++;
for (i = 0; i < 3; i++)
// kHz
while (i < 8)
{
const uint8_t Digit = pDigits[i + 3];
memcpy(pFb0 + (i * 13) + 42, gFontBigDigits[Digit] + 0, 13);
memcpy(pFb1 + (i * 13) + 42, gFontBigDigits[Digit] + 13, 13);
const unsigned int Digit = pDigits[i++];
memcpy(pFb, gFontSmallDigits[Digit], char_width);
pFb += char_width;
}
}
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y)
{
unsigned int i;
for (i = 0; i < Size; i++)
memcpy(gFrameBuffer[Y] + (i * 7) + X, gFontSmallDigits[(uint8_t)pString[i]], 7);
const unsigned int char_width = 7;
unsigned int x = X;
unsigned int i;
for (i = 0; i < Size; i++, x += char_width)
memcpy(gFrameBuffer[Y] + x, gFontSmallDigits[(unsigned int)pString[i]], char_width);
}

View File

@ -23,7 +23,9 @@
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_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);
#endif

243
ui/main.c
View File

@ -30,8 +30,8 @@
void UI_DisplayMain(void)
{
char String[16];
uint8_t i;
char String[16];
unsigned int vfo_num;
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
@ -43,34 +43,19 @@ void UI_DisplayMain(void)
return;
}
for (i = 0; i < 2; i++)
for (vfo_num = 0; vfo_num < 2; vfo_num++)
{
uint8_t *pLine0;
uint8_t *pLine1;
uint8_t Line;
uint8_t Channel;
bool bIsSameVfo;
if (i == 0)
{
pLine0 = gFrameBuffer[0];
pLine1 = gFrameBuffer[1];
Line = 0;
}
else
{
pLine0 = gFrameBuffer[4];
pLine1 = gFrameBuffer[5];
Line = 4;
}
Channel = gEeprom.TX_CHANNEL;
bIsSameVfo = !!(Channel == i);
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;
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
Channel = gEeprom.RX_CHANNEL;
if (Channel != i)
if (Channel != vfo_num)
{
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
{
@ -105,7 +90,7 @@ void UI_DisplayMain(void)
else
sprintf(String, ">%s", gDTMF_InputBox);
UI_PrintString(String, 2, 127, i * 3, 8, false);
UI_PrintString(String, 2, 127, vfo_num * 3, 8, false);
memset(String, 0, sizeof(String));
memset(Contact, 0, sizeof(Contact));
@ -132,7 +117,7 @@ void UI_DisplayMain(void)
sprintf(String, ">%s", gDTMF_String);
}
UI_PrintString(String, 2, 127, 2 + (i * 3), 8, false);
UI_PrintString(String, 2, 127, 2 + (vfo_num * 3), 8, false);
continue;
}
@ -165,7 +150,7 @@ void UI_DisplayMain(void)
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == i)
if (Channel == vfo_num)
{
SomeValue = 1;
memcpy(pLine0 + 14, BITMAP_TX, sizeof(BITMAP_TX));
@ -176,34 +161,34 @@ void UI_DisplayMain(void)
{
SomeValue = 2;
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == i)
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX));
}
// 0x8F3C
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i)
NUMBER_ToDigits(gEeprom.ScreenChannel[i] + 1, String);
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);
}
else
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]))
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{
char c;
memcpy(pLine1 + 14, BITMAP_F, sizeof(BITMAP_F));
c = (gEeprom.ScreenChannel[i] - FREQ_CHANNEL_FIRST) + 1;
c = (gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST) + 1;
UI_DisplaySmallDigits(1, &c, 22, Line + 1);
}
else
{
memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i)
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num)
{
NUMBER_ToDigits((gEeprom.ScreenChannel[i] - NOAA_CHANNEL_FIRST) + 1, String);
NUMBER_ToDigits((gEeprom.ScreenChannel[vfo_num] - NOAA_CHANNEL_FIRST) + 1, String);
}
else
{
@ -215,7 +200,7 @@ void UI_DisplayMain(void)
// 0x8FEC
uint8_t State = VfoState[i];
uint8_t State = VfoState[vfo_num];
#ifndef DISABLE_ALARM
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
@ -224,7 +209,7 @@ void UI_DisplayMain(void)
Channel = gEeprom.RX_CHANNEL;
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == i)
if (Channel == vfo_num)
State = VFO_STATE_ALARM;
}
#endif
@ -259,65 +244,86 @@ void UI_DisplayMain(void)
break;
}
UI_PrintString(String, 31, 111, i * 4, Width, true);
UI_PrintString(String, 31, 111, vfo_num * 4, Width, true);
}
else
{
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i)
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
{
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
UI_DisplayFrequency(gInputBox, 31, vfo_num * 4, true, false);
}
else
{
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{
if (gCurrentFunction == FUNCTION_TRANSMIT)
{
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
Channel = gEeprom.RX_CHANNEL;
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
else
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
}
else
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
switch (gEeprom.CHANNEL_DISPLAY_MODE)
{
case MDF_FREQUENCY:
if (gCurrentFunction == FUNCTION_TRANSMIT)
NUMBER_ToDigits(frequency_Hz, String);
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
Channel = gEeprom.RX_CHANNEL;
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == i)
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
}
else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
UI_DisplayFrequency(String, 31, i * 4, false, false);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
{
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (Attributes & MR_CH_SCANLIST1)
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
if (Attributes & MR_CH_SCANLIST2)
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
}
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
frequency_Hz = 0;
break;
case MDF_CHANNEL:
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
#ifdef CHAN_NAME_FREQ
UI_PrintStringSmall(String, 31 + 8, 0, (vfo_num * 4) + 1, false);
#else
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
#endif
break;
case MDF_NAME:
if (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF)
{
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
}
else
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
#ifdef CHAN_NAME_FREQ
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 1, false);
}
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, (vfo_num * 4) + 1, false);
}
#else
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
}
else
{ // channel name
UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, vfo_num * 4, 8, true);
}
#endif
break;
}
}
@ -329,20 +335,20 @@ void UI_DisplayMain(void)
Channel = gEeprom.RX_CHANNEL;
else
Channel = gEeprom.TX_CHANNEL;
if (Channel == i)
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
if (Channel == vfo_num)
frequency_Hz = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
}
else
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
frequency_Hz = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
UI_DisplayFrequency(String, 31, i * 4, false, false);
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (Attributes & MR_CH_SCANLIST1)
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
@ -352,6 +358,8 @@ void UI_DisplayMain(void)
}
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
frequency_Hz = 0;
}
}
}
@ -372,37 +380,29 @@ void UI_DisplayMain(void)
else
if (SomeValue == 2)
{
if (gVFO_RSSI_Level[i])
Level = gVFO_RSSI_Level[i];
if (gVFO_RSSI_Level[vfo_num])
Level = gVFO_RSSI_Level[vfo_num];
}
// TODO: not quite how the original does it, but it's quite entangled in Ghidra
if (Level)
// show TX power level
if (Level >= 1)
{
memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (Level >= 2)
{
memcpy(pLine1 + 128 + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (Level >= 3)
{
memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (Level >= 4)
{
memcpy(pLine1 + 128 + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (Level >= 5)
{
memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 6)
memcpy(pLine1 + 128 + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
}
}
}
}
memcpy(pLine1 + 128 + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (Level >= 3)
memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (Level >= 4)
memcpy(pLine1 + 128 + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (Level >= 5)
memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (Level >= 6)
memcpy(pLine1 + 128 + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
}
// 0x931E
if (gEeprom.VfoInfo[i].IsAM)
if (gEeprom.VfoInfo[vfo_num].IsAM)
{
memcpy(pLine1 + 128 + 27, BITMAP_AM, sizeof(BITMAP_AM));
}
@ -410,7 +410,7 @@ void UI_DisplayMain(void)
{
const FREQ_Config_t *pConfig;
pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[i].pTX : gEeprom.VfoInfo[i].pRX;
pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
switch (pConfig->CodeType)
{
@ -427,38 +427,51 @@ void UI_DisplayMain(void)
}
// 0x936C
switch (gEeprom.VfoInfo[i].OUTPUT_POWER)
switch (gEeprom.VfoInfo[vfo_num].OUTPUT_POWER)
{
case OUTPUT_POWER_LOW:
memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow));
memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow));
break;
case OUTPUT_POWER_MID:
memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid));
memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid));
break;
case OUTPUT_POWER_HIGH:
memcpy(pLine1 + 128 + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh));
break;
}
if (gEeprom.VfoInfo[i].ConfigRX.Frequency != gEeprom.VfoInfo[i].ConfigTX.Frequency)
if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency)
{
if (gEeprom.VfoInfo[i].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));
if (gEeprom.VfoInfo[i].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));
}
if (gEeprom.VfoInfo[i].FrequencyReverse)
if (gEeprom.VfoInfo[vfo_num].FrequencyReverse)
memcpy(pLine1 + 128 + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode));
if (gEeprom.VfoInfo[i].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
if (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
memcpy(pLine1 + 128 + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
if (gEeprom.VfoInfo[i].DTMF_DECODING_ENABLE || gSetting_KILLED)
if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED)
memcpy(pLine1 + 128 + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF));
if (gEeprom.VfoInfo[i].SCRAMBLING_TYPE && gSetting_ScrambleEnable)
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 above the channel number/name
#if 0
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequencySmall(String, 31 + 8, (vfo_num * 4) + 0, false);
#else
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
UI_PrintStringSmall(String, 31 + 8, 0, (vfo_num * 4) + 0, false);
#endif
}
#endif
}
ST7565_BlitFullScreen();

View File

@ -27,7 +27,7 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
{
uint8_t *pLine;
uint8_t Line;
bool bIsClearMode;
bool bIsClearMode = false;
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
return;
@ -52,20 +52,19 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
}
else
{
memcpy(pLine, BITMAP_Antenna, 5);
memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (RssiLevel >= 2) // 2
memcpy(pLine, BITMAP_Antenna, 5);
if (RssiLevel >= 2)
memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
if (RssiLevel >= 3)
memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
if (RssiLevel >= 3) // 3
if (RssiLevel >= 4)
memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
if (RssiLevel >= 4) // 4
if (RssiLevel >= 5)
memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
if (RssiLevel >= 5) // 5
if (RssiLevel >= 6)
memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
if (RssiLevel >= 6) // 6
if (RssiLevel >= 7)
memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
bIsClearMode = false;
}
ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode);
@ -73,22 +72,32 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
void UI_UpdateRSSI(uint16_t RSSI)
{
//const int16_t dB = (int16_t)(RSSI / 2) - 160;
const uint16_t level0 = gEEPROM_RSSI_CALIB[gRxVfo->Band][0];
const uint16_t level1 = gEEPROM_RSSI_CALIB[gRxVfo->Band][1];
const uint16_t level2 = gEEPROM_RSSI_CALIB[gRxVfo->Band][2];
const uint16_t level3 = gEEPROM_RSSI_CALIB[gRxVfo->Band][3];
const uint16_t level01 = (level0 + level1) / 2;
const uint16_t level12 = (level1 + level2) / 2;
const uint16_t level23 = (level2 + level3) / 2;
uint8_t Level = 0;
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][3])
Level = 6;
if (RSSI >= level3) Level = 7;
else
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][2])
Level = 4;
if (RSSI >= level23) Level = 6;
else
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][1])
Level = 2;
if (RSSI >= level2) Level = 5;
else
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][0])
Level = 1;
if (RSSI >= level12) Level = 4;
else
if (RSSI >= level1) Level = 3;
else
if (RSSI >= level01) Level = 2;
else
if (RSSI >= level0) Level = 1;
//const int16_t dB = (int16_t)(RSSI / 2) - 160;
if (gVFO_RSSI_Level[gEeprom.RX_CHANNEL] != Level)
{
gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = Level;