fix: Yaris 2013 OBD compatibility hardening
- _decode_odometer: catch all exceptions and return None instead of raising. PID 0xA6 (odometer) is not guaranteed on 2013 Toyota Yaris — a garbage response or unsupported PID previously raised ValueError through python-obd's decoder, which app_obd._query() caught and treated as a lost connection, killing the entire OBD session. Now it gracefully returns None. - connect_obd: reset all sensor globals (rpm, coolant_temp, fuel_level, throttle_position, mil_on, dtc_codes, odometer, timestamps) on each new connection so the UI doesn't display stale readings from the previous ignition cycle while fresh polls are completing. - yaris-obd.service: add commented OBD_PROTOCOL=6 hint for post-confirmation pinning (eliminates 3-5s auto-probe delay after first confirmed connection). Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -12,6 +12,11 @@ WorkingDirectory=/home/yaris/app/yaris-obd
|
||||
# the log file promptly instead of sitting in Python's stdout buffer indefinitely
|
||||
# when it's redirected to a file instead of a TTY.
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
# Once OBD is confirmed working on this car, pin the protocol to skip the
|
||||
# 3-5s auto-detect probe on every ignition-on: e.g. OBD_PROTOCOL=6 for
|
||||
# ISO 15765-4 CAN 11-bit 500kbps (correct for 2013 Toyota Yaris).
|
||||
# Leave unset during initial setup so auto-detect can find the right value.
|
||||
#Environment=OBD_PROTOCOL=6
|
||||
ExecStart=/home/yaris/app/yaris-obd/venv/bin/python app.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
Reference in New Issue
Block a user