Fix #234: Bring back FM radio status indicator, show dual watch inactive while in FM radio

This commit is contained in:
Krzysiek Egzmont
2023-12-12 00:52:26 +01:00
parent 6bdce2d0e2
commit 0c2fc6184c
4 changed files with 40 additions and 18 deletions

View File

@@ -623,6 +623,7 @@ void FM_Play(void)
void FM_Start(void) void FM_Start(void)
{ {
gDualWatchActive = false;
gFmRadioMode = true; gFmRadioMode = true;
gFM_ScanState = FM_SCAN_OFF; gFM_ScanState = FM_SCAN_OFF;
gFM_RestoreCountdown_10ms = 0; gFM_RestoreCountdown_10ms = 0;

View File

@@ -42,6 +42,20 @@ const uint8_t BITMAP_RX[8] =
0b00000000 0b00000000
}; };
const uint8_t BITMAP_FM[10] =
{ // "FM"
0b00000000,
0b01111111,
0b00001001,
0b00000001,
0b00000000,
0b01111111,
0b00000010,
0b00001100,
0b00000010,
0b01111111
};
const uint8_t BITMAP_BatteryLevel[2] = const uint8_t BITMAP_BatteryLevel[2] =
{ {
0b01011101, 0b01011101,
@@ -170,8 +184,9 @@ const uint8_t BITMAP_XB[12] =
}; };
const uint8_t BITMAP_TDR1[15] = const uint8_t BITMAP_TDR1[16] =
{ // "DWR" { // "DWR"
0b00000000,
0b01111111, 0b01111111,
0b01000001, 0b01000001,
0b01000001, 0b01000001,
@@ -189,8 +204,9 @@ const uint8_t BITMAP_TDR1[15] =
0b01000110 0b01000110
}; };
const uint8_t BITMAP_TDR2[9] = const uint8_t BITMAP_TDR2[10] =
{ // "><" .. DW on hold { // "><" .. DW on hold
0b00000000,
0b00100010, 0b00100010,
0b00110110, 0b00110110,
0b00011100, 0b00011100,

View File

@@ -7,7 +7,7 @@
extern const uint8_t BITMAP_POWERSAVE[8]; extern const uint8_t BITMAP_POWERSAVE[8];
extern const uint8_t BITMAP_TX[8]; extern const uint8_t BITMAP_TX[8];
extern const uint8_t BITMAP_RX[8]; extern const uint8_t BITMAP_RX[8];
extern const uint8_t BITMAP_FM[10];
extern const uint8_t BITMAP_BatteryLevel[2]; extern const uint8_t BITMAP_BatteryLevel[2];
extern const uint8_t BITMAP_BatteryLevel1[17]; extern const uint8_t BITMAP_BatteryLevel1[17];
@@ -23,8 +23,8 @@ extern const uint8_t BITMAP_F_Key[6];
extern const uint8_t BITMAP_XB[12]; extern const uint8_t BITMAP_XB[12];
extern const uint8_t BITMAP_TDR1[15]; extern const uint8_t BITMAP_TDR1[16];
extern const uint8_t BITMAP_TDR2[9]; extern const uint8_t BITMAP_TDR2[10];
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
extern const uint8_t BITMAP_VoicePrompt[9]; extern const uint8_t BITMAP_VoicePrompt[9];

View File

@@ -70,6 +70,13 @@ void UI_DisplayStatus()
x1 = x + 10; x1 = x + 10;
} }
else else
#endif
#ifdef ENABLE_FMRADIO
if (gFmRadioMode) { // FM indicator
memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM));
x1 = x + sizeof(BITMAP_FM);
}
else
#endif #endif
{ // SCAN indicator { // SCAN indicator
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) { if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) {
@@ -84,11 +91,11 @@ void UI_DisplayStatus()
else { // frequency mode else { // frequency mode
s = "S"; s = "S";
} }
UI_PrintStringSmallBuffer(s, line + x); UI_PrintStringSmallBuffer(s, line + x + 1);
x1 = x + 7; x1 = x + 10;
} }
} }
x += 7; // font character width x += 10; // font character width
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
// VOICE indicator // VOICE indicator
@@ -96,35 +103,33 @@ void UI_DisplayStatus()
memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
x1 = x + sizeof(BITMAP_VoicePrompt); x1 = x + sizeof(BITMAP_VoicePrompt);
} }
x += sizeof(BITMAP_VoicePrompt) + 1; x += sizeof(BITMAP_VoicePrompt);
#endif #endif
x++;
if(!SCANNER_IsScanning()) { if(!SCANNER_IsScanning()) {
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
if(dw == 1 || dw == 3) { // DWR - dual watch + respond if(dw == 1 || dw == 3) { // DWR - dual watch + respond
if(gDualWatchActive) if(gDualWatchActive)
memcpy(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5)); memcpy(line + x + (dw==1?0:2), BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
else else
memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2)); memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
} }
else if(dw == 2) { // XB - crossband else if(dw == 2) { // XB - crossband
memcpy(line + x, BITMAP_XB, sizeof(BITMAP_XB)); memcpy(line + x + 2, BITMAP_XB, sizeof(BITMAP_XB));
} }
} }
x += sizeof(BITMAP_TDR1) + 2; x += sizeof(BITMAP_TDR1) + 1;
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
// VOX indicator // VOX indicator
if (gEeprom.VOX_SWITCH) { if (gEeprom.VOX_SWITCH) {
memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX)); memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
x1 = x + sizeof(BITMAP_VOX); x1 = x + sizeof(BITMAP_VOX) + 1;
} }
x += sizeof(BITMAP_VOX) + 2; x += sizeof(BITMAP_VOX) + 1;
#endif #endif
x = MAX(x, 61u); x = MAX(x1, 61u);
x1 = x;
// KEY-LOCK indicator // KEY-LOCK indicator
if (gEeprom.KEY_LOCK) { if (gEeprom.KEY_LOCK) {
@@ -140,7 +145,7 @@ void UI_DisplayStatus()
{ // battery voltage or percentage { // battery voltage or percentage
char s[8] = ""; char s[8] = "";
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 3; unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;
if (gChargingWithTypeC) if (gChargingWithTypeC)
x2 -= sizeof(BITMAP_USB_C); // the radio is on charge x2 -= sizeof(BITMAP_USB_C); // the radio is on charge