Skip to content

Commit

Permalink
Fix egzumer#234: Bring back FM radio status indicator, show dual watc…
Browse files Browse the repository at this point in the history
…h inactive while in FM radio
  • Loading branch information
egzumer committed Dec 11, 2023
1 parent 6bdce2d commit 0c2fc61
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
1 change: 1 addition & 0 deletions app/fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ void FM_Play(void)

void FM_Start(void)
{
gDualWatchActive = false;
gFmRadioMode = true;
gFM_ScanState = FM_SCAN_OFF;
gFM_RestoreCountdown_10ms = 0;
Expand Down
20 changes: 18 additions & 2 deletions bitmaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ const uint8_t BITMAP_RX[8] =
0b00000000
};

const uint8_t BITMAP_FM[10] =
{ // "FM"
0b00000000,
0b01111111,
0b00001001,
0b00000001,
0b00000000,
0b01111111,
0b00000010,
0b00001100,
0b00000010,
0b01111111
};

const uint8_t BITMAP_BatteryLevel[2] =
{
0b01011101,
Expand Down Expand Up @@ -170,8 +184,9 @@ const uint8_t BITMAP_XB[12] =
};


const uint8_t BITMAP_TDR1[15] =
const uint8_t BITMAP_TDR1[16] =
{ // "DWR"
0b00000000,
0b01111111,
0b01000001,
0b01000001,
Expand All @@ -189,8 +204,9 @@ const uint8_t BITMAP_TDR1[15] =
0b01000110
};

const uint8_t BITMAP_TDR2[9] =
const uint8_t BITMAP_TDR2[10] =
{ // "><" .. DW on hold
0b00000000,
0b00100010,
0b00110110,
0b00011100,
Expand Down
6 changes: 3 additions & 3 deletions bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
extern const uint8_t BITMAP_POWERSAVE[8];
extern const uint8_t BITMAP_TX[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_BatteryLevel1[17];

Expand All @@ -23,8 +23,8 @@ extern const uint8_t BITMAP_F_Key[6];

extern const uint8_t BITMAP_XB[12];

extern const uint8_t BITMAP_TDR1[15];
extern const uint8_t BITMAP_TDR2[9];
extern const uint8_t BITMAP_TDR1[16];
extern const uint8_t BITMAP_TDR2[10];

#ifdef ENABLE_VOICE
extern const uint8_t BITMAP_VoicePrompt[9];
Expand Down
31 changes: 18 additions & 13 deletions ui/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ void UI_DisplayStatus()
x1 = x + 10;
}
else
#endif
#ifdef ENABLE_FMRADIO
if (gFmRadioMode) { // FM indicator
memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM));
x1 = x + sizeof(BITMAP_FM);
}
else
#endif
{ // SCAN indicator
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) {
Expand All @@ -84,47 +91,45 @@ void UI_DisplayStatus()
else { // frequency mode
s = "S";
}
UI_PrintStringSmallBuffer(s, line + x);
x1 = x + 7;
UI_PrintStringSmallBuffer(s, line + x + 1);
x1 = x + 10;
}
}
x += 7; // font character width
x += 10; // font character width

#ifdef ENABLE_VOICE
// VOICE indicator
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){
memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
x1 = x + sizeof(BITMAP_VoicePrompt);
}
x += sizeof(BITMAP_VoicePrompt) + 1;
x += sizeof(BITMAP_VoicePrompt);
#endif

x++;
if(!SCANNER_IsScanning()) {
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(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
memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
}
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
// VOX indicator
if (gEeprom.VOX_SWITCH) {
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

x = MAX(x, 61u);
x1 = x;
x = MAX(x1, 61u);

// KEY-LOCK indicator
if (gEeprom.KEY_LOCK) {
Expand All @@ -140,7 +145,7 @@ void UI_DisplayStatus()

{ // battery voltage or percentage
char s[8] = "";
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 3;
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;

if (gChargingWithTypeC)
x2 -= sizeof(BITMAP_USB_C); // the radio is on charge
Expand Down

0 comments on commit 0c2fc61

Please sign in to comment.