Repository navigation
Project the parked drain from odometer-steady samples - #85
Conversation
|
Projection fix on the phone — 24 h chart, real data. The x-axis now spans 05 Oct 12:29 → 07 Oct 00:29 (24 h back + the 12 h horizon) and the dashed line drops 72 → 68 % over 12 h instead of the old near-vertical stub at the right edge. Caption: The 6 h chart shows no projection right now: the newest sample is 2 h 11 m old, past the 6 h range's freshness bound (1.5 h). |
|
Actually we should only project based on Parked slope. Waiting for #94 and getDriveState to land first. |
ScreenshotsCaptured from the demo build at 2a1b34a. Debug APK: zip from Android CI (GitHub sign-in needed) |
A build of the original #85 branch wrote an earlier record format to <vehicleId>.status.pblog. The envelope reader stops at the first such record, so that file would hide every later status reading. A new name leaves the old file ignored, like the old raw charge logs, with no manual delete before testing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129RzhbEE2cboMcYyZMuxqX
ScreenshotsCaptured from the demo build at 7aadccf. Debug APK: zip from Android CI (GitHub sign-in needed) |
…head The discharge projection now measures the drain over the selected range from parked pairs of consecutive battery samples only: neither sample is charging and the odometer did not move between them. Each sample takes the odometer of the drive sample nearest to it within two minutes (a drive read follows every charge read); a sample without one is not known to be parked, so its pairs are left out. A long unobserved gap still counts when the odometer is unchanged across it, which keeps the overnight drop up to the wake-up read, while a drive no phone saw shows up as an odometer change. Signed changes are summed, so a parked rounding blip cancels out. The horizon is half the selected range and the chart's x-axis expands by it. With the sparser reads of the Infotainment poll policy (none while asleep), the old 30 min to 6 h freshness bound hid the projection for most of a night parked, so the projection now stays until its whole line lies in the past: the last sample is older than the horizon. The car screen gets the selected car's drive samples; MainScreen takes both lists as one HistorySamples value to stay within detekt's parameter limit. The demo history seeds a DriveState next to each charge record, with the odometer moving only across its drives and ending at the simulated car's live odometer. The discharge tests move to a kotlin.test DischargeProjectionTest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129RzhbEE2cboMcYyZMuxqX
7aadccf to
e7cc97a
Compare
ScreenshotsCaptured from the demo build at e7cc97a. Debug APK: zip from Android CI (GitHub sign-in needed) |
ScreenshotsLight Dark Captured from the demo build at a47c909. Debug APK: zip from Android CI (GitHub sign-in needed) |
ScreenshotsLight Dark Captured from the demo build at 91efc11. Debug APK: zip from Android CI (GitHub sign-in needed) |
















Summary
Bases the discharge projection on the parked drain only, using the DriveState odometer (#149) to tell parked stretches from drives. One commit on top of
main.What counts as parked
Horizon and chart
Sparse samples (#161). Battery reads now come every 20 min while parked and awake, and not at all while asleep. I checked the two rules:
Wiring.
MainScreentakes battery and drive samples as oneHistorySamplesvalue. That keeps it at 14 parameters, under detekt's limit, without raising the threshold.Type
Testing
./gradlew :core:test.DischargeProjectionTest(kotlin.test, 13 cases) covers:./gradlew :app:testDebugUnitTest./gradlew :app:lintDebug./gradlew :app:assembleDebug,ktlintCheck,detekt. The full build from the brief is green locally.Checklist
expected.txtregenerated, not hand-edited (n/a: no protocol change)SPDX-License-Identifier: AGPL-3.0-only🤖 Generated with Claude Code
https://claude.ai/code/session_0129RzhbEE2cboMcYyZMuxqX