App 2.19.7: meter AC charging too, while the app runs

A session runs whenever power flows into the pack, AC or DC; gaps the
head unit slept through are dropped as before. Dashboard and server
texts no longer say DC only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
2026-10-23 22:07:03 +02:00
co-authored by Claude Opus 5.5
parent e6f8258203
commit 93e7e4cb63
10 changed files with 60 additions and 25 deletions
@@ -1590,12 +1590,11 @@ public class MainActivity extends AppCompatActivity {
boolean charging = ChargingState.isCharging(
code, s.getChargePortConnected(), s.getBatteryPowerKw(), s.getSpeedKmh());
ChargeSessionTracker.Snapshot session = chargeSessionTracker.snapshot();
// Only DC is metered, so an AC charge must say so rather than let the readouts
// below — which then describe the previous DC session — be read as this charge.
// AC and DC are both metered while the app runs; the label only says which.
boolean dc = ChargingState.isDcCharging(
code, s.getChargePortConnected(), s.getBatteryPowerKw(), s.getSpeedKmh());
chargeStatus.setText(dc ? R.string.charge_dc
: charging ? R.string.charge_ac_not_metered
: charging ? R.string.charge_ac
: (session.startedAtMs > 0 ? R.string.charge_last : R.string.charging_not_charging));
chargeSoc.setText(fmt(s.getSocPercent(), "%.1f %%"));
chargeStartSoc.setText(fmt(session.startSocPercent, "%.1f %%"));