Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Simplified logic to remove duplicate code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dual Tachyon authored and Dual Tachyon committed Sep 18, 2023
1 parent 3a47809 commit d180585
Showing 1 changed file with 11 additions and 43 deletions.
54 changes: 11 additions & 43 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,49 +230,7 @@ void UI_DisplayMain(void)
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i) {
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
} else {
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
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].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]];
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);
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);
} else {
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
}
break;
}
} else {
if (!IS_MR_CHANNEL(gEeprom.ScreenChannel[i]) || gEeprom.CHANNEL_DISPLAY_MODE == MDF_FREQUENCY) {
if (gCurrentFunction == FUNCTION_TRANSMIT) {
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) {
Channel = gEeprom.RX_CHANNEL;
Expand All @@ -298,6 +256,16 @@ void UI_DisplayMain(void)
}
}
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
} else if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_CHANNEL) {
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
UI_PrintString(String, 31, 112, i * 4, 8, true);
} else if (gEeprom.CHANNEL_DISPLAY_MODE == 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);
}
}
}
}
Expand Down

0 comments on commit d180585

Please sign in to comment.