Skip to content

Commit 0c2fc61

Browse files
committed
Fix #234: Bring back FM radio status indicator, show dual watch inactive while in FM radio
1 parent 6bdce2d commit 0c2fc61

File tree

4 files changed

+40
-18
lines changed

4 files changed

+40
-18
lines changed

app/fm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ void FM_Play(void)
623623

624624
void FM_Start(void)
625625
{
626+
gDualWatchActive = false;
626627
gFmRadioMode = true;
627628
gFM_ScanState = FM_SCAN_OFF;
628629
gFM_RestoreCountdown_10ms = 0;

bitmaps.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ const uint8_t BITMAP_RX[8] =
4242
0b00000000
4343
};
4444

45+
const uint8_t BITMAP_FM[10] =
46+
{ // "FM"
47+
0b00000000,
48+
0b01111111,
49+
0b00001001,
50+
0b00000001,
51+
0b00000000,
52+
0b01111111,
53+
0b00000010,
54+
0b00001100,
55+
0b00000010,
56+
0b01111111
57+
};
58+
4559
const uint8_t BITMAP_BatteryLevel[2] =
4660
{
4761
0b01011101,
@@ -170,8 +184,9 @@ const uint8_t BITMAP_XB[12] =
170184
};
171185

172186

173-
const uint8_t BITMAP_TDR1[15] =
187+
const uint8_t BITMAP_TDR1[16] =
174188
{ // "DWR"
189+
0b00000000,
175190
0b01111111,
176191
0b01000001,
177192
0b01000001,
@@ -189,8 +204,9 @@ const uint8_t BITMAP_TDR1[15] =
189204
0b01000110
190205
};
191206

192-
const uint8_t BITMAP_TDR2[9] =
207+
const uint8_t BITMAP_TDR2[10] =
193208
{ // "><" .. DW on hold
209+
0b00000000,
194210
0b00100010,
195211
0b00110110,
196212
0b00011100,

bitmaps.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
extern const uint8_t BITMAP_POWERSAVE[8];
88
extern const uint8_t BITMAP_TX[8];
99
extern const uint8_t BITMAP_RX[8];
10-
10+
extern const uint8_t BITMAP_FM[10];
1111
extern const uint8_t BITMAP_BatteryLevel[2];
1212
extern const uint8_t BITMAP_BatteryLevel1[17];
1313

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

2424
extern const uint8_t BITMAP_XB[12];
2525

26-
extern const uint8_t BITMAP_TDR1[15];
27-
extern const uint8_t BITMAP_TDR2[9];
26+
extern const uint8_t BITMAP_TDR1[16];
27+
extern const uint8_t BITMAP_TDR2[10];
2828

2929
#ifdef ENABLE_VOICE
3030
extern const uint8_t BITMAP_VoicePrompt[9];

ui/status.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ void UI_DisplayStatus()
7070
x1 = x + 10;
7171
}
7272
else
73+
#endif
74+
#ifdef ENABLE_FMRADIO
75+
if (gFmRadioMode) { // FM indicator
76+
memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM));
77+
x1 = x + sizeof(BITMAP_FM);
78+
}
79+
else
7380
#endif
7481
{ // SCAN indicator
7582
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) {
@@ -84,47 +91,45 @@ void UI_DisplayStatus()
8491
else { // frequency mode
8592
s = "S";
8693
}
87-
UI_PrintStringSmallBuffer(s, line + x);
88-
x1 = x + 7;
94+
UI_PrintStringSmallBuffer(s, line + x + 1);
95+
x1 = x + 10;
8996
}
9097
}
91-
x += 7; // font character width
98+
x += 10; // font character width
9299

93100
#ifdef ENABLE_VOICE
94101
// VOICE indicator
95102
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){
96103
memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
97104
x1 = x + sizeof(BITMAP_VoicePrompt);
98105
}
99-
x += sizeof(BITMAP_VoicePrompt) + 1;
106+
x += sizeof(BITMAP_VoicePrompt);
100107
#endif
101108

102-
x++;
103109
if(!SCANNER_IsScanning()) {
104110
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
105111
if(dw == 1 || dw == 3) { // DWR - dual watch + respond
106112
if(gDualWatchActive)
107-
memcpy(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
113+
memcpy(line + x + (dw==1?0:2), BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
108114
else
109115
memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
110116
}
111117
else if(dw == 2) { // XB - crossband
112-
memcpy(line + x, BITMAP_XB, sizeof(BITMAP_XB));
118+
memcpy(line + x + 2, BITMAP_XB, sizeof(BITMAP_XB));
113119
}
114120
}
115-
x += sizeof(BITMAP_TDR1) + 2;
121+
x += sizeof(BITMAP_TDR1) + 1;
116122

117123
#ifdef ENABLE_VOX
118124
// VOX indicator
119125
if (gEeprom.VOX_SWITCH) {
120126
memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
121-
x1 = x + sizeof(BITMAP_VOX);
127+
x1 = x + sizeof(BITMAP_VOX) + 1;
122128
}
123-
x += sizeof(BITMAP_VOX) + 2;
129+
x += sizeof(BITMAP_VOX) + 1;
124130
#endif
125131

126-
x = MAX(x, 61u);
127-
x1 = x;
132+
x = MAX(x1, 61u);
128133

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

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

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

0 commit comments

Comments
 (0)