Skip to content

Commit 25f5c90

Browse files
malysclaude
andcommitted
feat: a finished trip is saved with the track it was integrated from
The recorder was storing totals and throwing the shape away. Every model this app is heading towards is fitted from that shape, so the recorder now hands the track to the versioned history file along with the summary. Nothing on screen changes. The point is that the data starts existing now, since a summary cannot be un-summarised later. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent f04733f commit 25f5c90

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ All notable changes follow [Keep a Changelog](https://keepachangelog.com/en/1.1.
4949

5050
### Changed
5151

52+
- **A recorded trip now stores its sample track alongside its totals.** The recorder hands the
53+
track to EVHardware's versioned history file, which keeps one sample per five seconds and
54+
drops the oldest tracks — never a whole trip — when the file approaches its size ceiling.
55+
Nothing on screen changes yet; the tracks are what the consumption, climate-share and
56+
arrival-state-of-charge models will be fitted from, and they have to exist before those
57+
models can.
58+
5259
- The diagnostics report is built on the sampler thread. It reads ten vehicle properties over
5360
binder and the crash file off disk, neither of which belongs on the thread drawing the dialog.
5461

‎app/src/main/java/com/evsuite/chargepilot/TripRecordingService.kt‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ class TripRecordingService : Service() {
140140
/** Called through the binder: the dashboard is on screen whenever a trip can be stopped. */
141141
fun stopTrip() {
142142
val endedAt = latestSnapshot?.timestampMs ?: System.currentTimeMillis()
143-
val summary = EnergyTripSession.stop(endedAt)
143+
val recorded = EnergyTripSession.stop(endedAt)
144144
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
145-
if (summary == null) {
145+
if (recorded == null) {
146146
stopWhenNobodyNeedsIt()
147147
return
148148
}
@@ -152,7 +152,8 @@ class TripRecordingService : Service() {
152152
// service stops itself the moment nobody needs it, and a stopSelf() racing the append
153153
// would drop the trip the driver just finished.
154154
sampler.execute {
155-
if (!tripStore.append(summary)) AppLogger.w(TAG, "trip history could not be saved")
155+
val saved = tripStore.append(recorded.summary, recorded.samples)
156+
if (!saved) AppLogger.w(TAG, "trip history could not be saved")
156157
main.post { stopWhenNobodyNeedsIt() }
157158
}
158159
}

0 commit comments

Comments
 (0)