Skip to content

Commit a6e741e

Browse files
authored
Merge pull request #1672 from ChaoticLeah/feature/mute-buzzer-icon
Add muted icon to show when buzzer is muted
2 parents 0abac35 + fb025fb commit a6e741e

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

examples/companion_radio/ui-new/UITask.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ class HomeScreen : public UIScreen {
131131
// fill the battery based on the percentage
132132
int fillWidth = (batteryPercentage * (iconWidth - 4)) / 100;
133133
display.fillRect(iconX + 2, iconY + 2, fillWidth, iconHeight - 4);
134+
135+
// show muted icon if buzzer is muted
136+
#ifdef PIN_BUZZER
137+
if (_task->isBuzzerQuiet()) {
138+
display.setColor(DisplayDriver::RED);
139+
display.drawXbm(iconX - 9, iconY + 1, muted_icon, 8, 8);
140+
}
141+
#endif
134142
}
135143

136144
CayenneLPP sensors_lpp;

examples/companion_radio/ui-new/UITask.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ class UITask : public AbstractUITask {
7878
bool hasDisplay() const { return _display != NULL; }
7979
bool isButtonPressed() const;
8080

81+
bool isBuzzerQuiet() {
82+
#ifdef PIN_BUZZER
83+
return buzzer.isQuiet();
84+
#else
85+
return true;
86+
#endif
87+
}
88+
8189
void toggleBuzzer();
8290
bool getGPSState();
8391
void toggleGPS();

examples/companion_radio/ui-new/icons.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,8 @@ static const uint8_t advert_icon[] = {
115115
0x38, 0x00, 0x00, 0x1C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x30,
116116
0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
117117
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118+
};
119+
120+
static const uint8_t muted_icon[] = {
121+
0x20, 0x6a, 0xea, 0xe4, 0xe4, 0xea, 0x6a, 0x20
118122
};

0 commit comments

Comments
 (0)