Fixed channel name display in MR mode.

This commit is contained in:
Dual Tachyon 2023-08-29 21:38:28 +01:00
parent ec2cb4e5e6
commit 947f114d65
4 changed files with 45 additions and 37 deletions

View File

@ -1733,7 +1733,7 @@ static void APP_ProcessKey_MAIN(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
}
if (g_200003BA != 0 && !bKeyHeld && bKeyPressed) {
char Character = DTMF_GetCharacter(Key);
if (Character != -1) {
if (Character != 0xFF) {
g_20000396 = 1;
XXX_Append(Character);
gRequestDisplayScreen = DISPLAY_MAIN;
@ -2048,7 +2048,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Code = -2;
} else {
Code = DTMF_GetCharacter(Key);
if (Code == -1) {
if (Code == 0xFF) {
goto Skip;
}
}

6
dtmf.c
View File

@ -26,12 +26,12 @@ bool DTMF_ValidateCodes(char *pCode, uint8_t Size)
{
uint8_t i;
if (pCode[0] == -1 || pCode[0] == 0) {
if (pCode[0] == 0xFF || pCode[0] == 0) {
return false;
}
for (i = 0; i < Size; i++) {
if (pCode[i] == -1 || pCode[i] == 0) {
if (pCode[i] == 0xFF || pCode[i] == 0) {
pCode[i] = 0;
break;
}
@ -98,7 +98,7 @@ char DTMF_GetCharacter(uint8_t Code)
return '#';
}
return -1;
return 0xFF;
}
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, uint8_t Size, bool bFlag)

View File

@ -91,6 +91,14 @@ enum ROGER_Mode_t {
typedef enum ROGER_Mode_t ROGER_Mode_t;
enum CHANNEL_DisplayMode_t {
MDF_FREQUENCY = 0U,
MDF_CHANNEL = 1U,
MDF_NAME = 2U,
};
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
typedef struct {
uint8_t ScreenChannel[2];
uint8_t FreqChannel[2];

View File

@ -218,46 +218,46 @@ void UI_DisplayMain(void)
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
} else {
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
if (gEeprom.CHANNEL_DISPLAY_MODE == 2 && (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == -1)) {
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
} else {
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
case 0:
if (gCurrentFunction == FUNCTION_TRANSMIT) {
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].pDCS_Reverse->Frequency, String);
} else {
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->Frequency, String);
}
switch (gEeprom.CHANNEL_DISPLAY_MODE) {
case MDF_FREQUENCY:
if (gCurrentFunction == FUNCTION_TRANSMIT) {
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].pDCS_Reverse->Frequency, String);
} else {
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->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]];
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));
}
} else {
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->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]];
if (Attributes & MR_CH_SCANLIST1) {
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
}
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
break;
case 1:
if (Attributes & MR_CH_SCANLIST2) {
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
}
}
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
break;
case MDF_CHANNEL:
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
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);
break;
case 2:
} else {
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
break;
}
break;
}
} else {
if (gCurrentFunction == FUNCTION_TRANSMIT) {