Skip to content

Commit dee8fff

Browse files
committed
BatteryIcon: Change color with charge percentage
1 parent 0fabfe9 commit dee8fff

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/displayapp/screens/BatteryIcon.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@ void BatteryIcon::SetBatteryPercentage(uint8_t percentage) {
2929
lv_obj_set_height(batteryJuice, percentage * 14 / 100);
3030
lv_obj_realign(batteryJuice);
3131
if (colorOnLowBattery) {
32-
static constexpr int lowBatteryThreshold = 15;
33-
static constexpr int criticalBatteryThreshold = 5;
34-
if (percentage > lowBatteryThreshold) {
35-
SetColor(LV_COLOR_WHITE);
36-
} else if (percentage > criticalBatteryThreshold) {
37-
SetColor(LV_COLOR_ORANGE);
38-
} else {
39-
SetColor(Colors::deepOrange);
40-
}
32+
SetColor(ColorFromPercentage(percentage));
4133
}
4234
}
4335

0 commit comments

Comments
 (0)