fix(phase26): geocode pre-caching (BUG-09) + gate trips on OBD presence (BUG-10)

This commit is contained in:
Mathieu Moran
2026-08-11 02:38:00 -04:00
parent a709517973
commit 7e913558f6
4 changed files with 107 additions and 3 deletions
+8
View File
@@ -49,6 +49,7 @@ stop_rpm = Event()
stop_sensors = Event()
connection = None
_car_ever_connected = False
def _decode_odometer(messages):
@@ -228,6 +229,8 @@ def connect_obd():
with _connection_lock:
connection = candidate
if candidate is not None:
_car_ever_connected = True
if candidate is None:
_emit_disconnected()
@@ -268,6 +271,11 @@ def get_fresh_speed(max_age=5):
def obd_connection():
"""Emit current state for a newly connected browser and ensure OBD is running."""
start_obd()
def was_car_ever_connected():
"""True if the car ECU has been reached at least once this session."""
return _car_ever_connected
if _is_car_connected():
app_events.socketio.emit("obd_status", obd_status[1])
app_events.socketio.emit("obd_speed", get_speedtime())