Browse Source

Show plug at >=95% instead of exactly 100%

Boards without a charge-complete signal only infer "full" from voltage, and
a real pack rarely reads the full BATT_MAX_MILLIVOLTS (4.2V), so the plug icon
was effectively never shown. Treat "full" as a high band (>= 95%) so the plug
appears when the battery is charged rather than requiring an exact 100%.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
pull/3054/head
romeomont 6 hours ago
parent
commit
9580d71a32
  1. 5
      examples/companion_radio/ui-new/UITask.cpp

5
examples/companion_radio/ui-new/UITask.cpp

@ -145,7 +145,10 @@ class HomeScreen : public UIScreen {
// keeping the fill bar itself clean and uninterrupted
bool charging = board.isExternalPowered();
if (charging) {
const uint8_t* symbol = (batteryPercentage < 100) ? charging_icon : plug_icon;
// There's no charge-complete signal on most boards, so "full" is a high
// voltage band rather than an exact 100% (a real pack rarely reads 4.2V).
const int BATT_FULL_PCT = 95;
const uint8_t* symbol = (batteryPercentage >= BATT_FULL_PCT) ? plug_icon : charging_icon;
display.setColor(UIColor::title_txt);
display.drawXbm(iconX - 9, iconY + 1, symbol, 8, 8);
}

Loading…
Cancel
Save