From dee8fffaa26b0961639867b1c585b4b85f72be80 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 12 Jan 2024 21:01:33 -0500 Subject: [PATCH] BatteryIcon: Change color with charge percentage --- src/displayapp/screens/BatteryIcon.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp index 8ebb1f5405..9e76430a1d 100644 --- a/src/displayapp/screens/BatteryIcon.cpp +++ b/src/displayapp/screens/BatteryIcon.cpp @@ -29,15 +29,7 @@ void BatteryIcon::SetBatteryPercentage(uint8_t percentage) { lv_obj_set_height(batteryJuice, percentage * 14 / 100); lv_obj_realign(batteryJuice); if (colorOnLowBattery) { - static constexpr int lowBatteryThreshold = 15; - static constexpr int criticalBatteryThreshold = 5; - if (percentage > lowBatteryThreshold) { - SetColor(LV_COLOR_WHITE); - } else if (percentage > criticalBatteryThreshold) { - SetColor(LV_COLOR_ORANGE); - } else { - SetColor(Colors::deepOrange); - } + SetColor(ColorFromPercentage(percentage)); } }