App 2.34.0: set the chosen drive mode again when the car starts

The car falls back to its own default mode at every start. With "Set at
start" (on by default), the service sets the mode last chosen on
Settings and confirmed by the car again, once, while the car is in P at
0 km/h, and gives up as soon as the car leaves P or after two minutes
(DriveModeWrite.atStart, unit-tested). The buttons and the start share
the write and read-back (DriveModeSetter). Not tried on the car.

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-25 20:12:11 +01:00
co-authored by Claude Opus 5.5
parent ce2ebd7f58
commit ed65c96319
13 changed files with 241 additions and 38 deletions
+14
View File
@@ -138,6 +138,20 @@ tyre pressures, GPS (lat, lon, elevation, heading) and the is_* flags. It does *
confirmed car facts, app structure, UI conventions, build/test/ship, documents. It replaces
upstream's EVABRPUploader text. The test emulator is now in the flake: `nix run .#car-emulator`
(Android 9 AOSP at 1920×720, 160 dpi; the car build installs as the system user — checked).
- 2026-10-25 — App 2.34.0 (branch `styles-retro-future`): **drive mode at start.** The car falls
back to its own default mode when switched on; with "Set at start" (on by default, the switch
in the drive mode card) the app sets the mode last chosen on Settings again. Only a choice the
car confirmed counts (`PREF_CHOSEN`, saved on APPLIED). `AbrpUploadService` starts with the
head unit and runs `DriveModeWrite.atStart` (pure, tested) once a second on its own thread:
wait for gear, speed and mode; nothing when the car already reports the mode; one write, in P
at 0 km/h, through the same `DriveModeSetter` as the buttons (write, read back up to 3 s); give
up for this start as soon as the car is out of P or moving, or after 2 minutes. So a mode set
with the car's own button after driving off stands. The result is kept with its time and
shown under the buttons ("At start (25.10. 20:31): Sport set."). Assumes the head unit starts
(and the service with it) when the car is switched on; a start without that (head unit kept
running) is not caught. A service restart (app update, after a kill) counts as a start, still
only in P at 0 km/h. Hints shortened to fit the page. Emulator: page fits, the start check
waits and gives up (no readings), no crash. Not tried on the car.
- 2026-10-25 — App 2.33.0 (branch `styles-retro-future`): **drive mode from Settings**, the first
vehicle setting the app writes. The owner lifted rule 3 for the drive mode only (AGENTS.md).
A card at the top of Settings' second column: Eco, Normal, Sport, Snow, Custom (codes 2, 3, 4,