App 2.33.0: set the drive mode from Settings, only in P at a standstill

The owner lifted the read-only rule for the drive mode alone. Settings
has Eco, Normal, Sport, Snow and Custom; the lit button is what the car
reports. A tap reads gear and speed fresh and writes only in P at 0 km/h
(DriveModeWrite, unit-tested; unreadable is a refusal), through a CPM-only
write behind EVHardware's standstill gate, then reads the mode back and
says what the car reports. The wide layout's charging price joined the
battery card so the page still fits. 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:02:53 +01:00
co-authored by Claude Opus 5.5
parent 703bdfd2a3
commit ce2ebd7f58
15 changed files with 268 additions and 12 deletions
@@ -2432,6 +2432,16 @@ object EVHardware {
return ok
}
/**
* The drive mode write Nils' MG4 uses: the CarPropertyManager write alone, behind
* [VehicleWriteGate] like every write here, without [setDriveMode]'s fallback binder
* transaction or its remembered "last mode". True means the write call went through, not
* that the car took it: read [getDriveModeRaw] back.
*/
@RequiresStandstill
fun writeDriveModeProperty(mode: DriveMode): Boolean =
setIntPropertyCPM(PROP_DRIVE_MODE, AREA_GLOBAL, mode.value)
@RequiresStandstill
fun setRegenLevel(level: RegenLevel): Boolean {
if (logEnabled) AppLogger.i(TAG, "setRegenLevel → ${level.label} (${level.value})")