From 5c502955522291f89bb5d2aaa4b3d414c1d1b9bc Mon Sep 17 00:00:00 2001 From: Jared Dohrman Date: Wed, 22 Apr 2026 18:06:29 +1000 Subject: [PATCH] fix: hide battery voltage range text for PMU-backed web stats --- docs/web-panel.md | 2 +- src/helpers/web/WebPanelServer.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/web-panel.md b/docs/web-panel.md index d8bc858c..e056fd0d 100644 --- a/docs/web-panel.md +++ b/docs/web-panel.md @@ -233,7 +233,7 @@ For boards that expose extra telemetry, the optional `Environment` summary card Metrics with no current value are hidden rather than showing placeholder rows, so the cards vary by board and by current sensor state. -The `Core` battery meter prefers a board-reported battery percentage when the target exposes one. Otherwise it scales the displayed percentage from the board's configured battery voltage range rather than assuming a fixed single-cell `3000-4200 mV` pack. +The `Core` battery meter prefers a board-reported battery percentage when the target exposes one. On those boards, the meter detail shows the live battery millivolt reading only. Otherwise it scales the displayed percentage from the board's configured battery voltage range and shows that range in the detail text rather than assuming a fixed single-cell `3000-4200 mV` pack. The trend graphs load sequentially rather than as one large payload: diff --git a/src/helpers/web/WebPanelServer.cpp b/src/helpers/web/WebPanelServer.cpp index a9ce9aee..39dc3996 100644 --- a/src/helpers/web/WebPanelServer.cpp +++ b/src/helpers/web/WebPanelServer.cpp @@ -1472,7 +1472,8 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML( : pctRange(core.battery_mv, batteryMin, batteryMax); const queuePct = pctRange(core.queue_len, 0, 12); const errorsPct = core.errors > 0 ? 100 : 0; - const batteryDetail = batteryMin < batteryMax + const usesBoardBatteryPercent = Number.isFinite(core.battery_pct) && core.battery_pct >= 0; + const batteryDetail = !usesBoardBatteryPercent && batteryMin < batteryMax ? (core.battery_mv || 0) + " mV (" + batteryMin + "-" + batteryMax + " mV)" : (core.battery_mv || 0) + " mV"; return `