From 89d24662ffed958bcf83cd7e74df95531a05762d Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Sat, 7 Feb 2026 20:41:29 +1100 Subject: [PATCH] Fixed battery indicator so it uses same linear mapping as BLE app --- examples/companion_radio/ui-new/UITask.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index ee419f5..bf81d95 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -104,12 +104,10 @@ class HomeScreen : public UIScreen { AdvertPath recent[UI_RECENT_LIST_SIZE]; - void renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) { - // Try to get accurate SOC from BQ27220 fuel gauge first - uint8_t batteryPercentage = board.getBatteryPercent(); - - // Fall back to voltage-based estimation if fuel gauge returns 0 - if (batteryPercentage == 0 && batteryMilliVolts > 0) { +void renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) { + // Use voltage-based estimation to match BLE app readings + uint8_t batteryPercentage = 0; + if (batteryMilliVolts > 0) { const int minMilliVolts = 3000; const int maxMilliVolts = 4200; int pct = ((batteryMilliVolts - minMilliVolts) * 100) / (maxMilliVolts - minMilliVolts);