We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0503248 commit bfaaffdCopy full SHA for bfaaffd
src/displayapp/screens/BatteryIcon.cpp
@@ -27,15 +27,9 @@ void BatteryIcon::SetBatteryPercentage(uint8_t percentage) {
27
lv_obj_set_height(batteryJuice, percentage * 14 / 100);
28
lv_obj_realign(batteryJuice);
29
if (colorOnLowBattery) {
30
- static constexpr int lowBatteryThreshold = 15;
31
- static constexpr int criticalBatteryThreshold = 5;
32
- if (percentage > lowBatteryThreshold) {
33
- SetColor(LV_COLOR_WHITE);
34
- } else if (percentage > criticalBatteryThreshold) {
35
- SetColor(LV_COLOR_ORANGE);
36
- } else {
37
- SetColor(Colors::deepOrange);
38
- }
+ uint8_t green = percentage * 255 / 100;
+ uint8_t red = 255 - green;
+ SetColor(LV_COLOR_MAKE(red, green, 0x0));
39
}
40
41
0 commit comments