Handle USB reconnect while out of park

This commit is contained in:
2026-06-07 12:14:43 +09:00
parent 7d672019b0
commit 582311ed47
3 changed files with 118 additions and 40 deletions
+6
View File
@@ -109,6 +109,12 @@ void setup() {
confirmedDriveMode = getRawDriveMode();
pendingDriveMode = confirmedDriveMode;
targetPosMs = getTargetForConfirmedMode();
if (confirmedDriveMode == HIGH) {
// USB serial reconnect can reset the board while the car is already out of P.
// In that case, assume the seat is already at the saved driving position.
currentPosMs = storedSeatPositionMs;
targetPosMs = storedSeatPositionMs;
}
if (ignitionState == LOW) {
ignitionOffStartTime = millis();
}