From fb1e8ce086ec5e2dc7b2150b62fdd99368eb7e66 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 16 Nov 2021 13:30:33 -0800 Subject: [PATCH] add offroad alerts for car unrecognized --- selfdrive/common/params.cc | 2 ++ selfdrive/controls/controlsd.py | 6 +++++- selfdrive/controls/lib/alerts_offroad.json | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index 7e65ec128c2742..01bf9a8f4f5b78 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -158,12 +158,14 @@ std::unordered_map keys = { {"ApiCache_DriveStats", PERSISTENT}, {"ApiCache_NavDestinations", PERSISTENT}, {"ApiCache_Owner", PERSISTENT}, + {"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON}, {"Offroad_ChargeDisabled", CLEAR_ON_MANAGER_START | CLEAR_ON_PANDA_DISCONNECT}, {"Offroad_ConnectivityNeeded", CLEAR_ON_MANAGER_START}, {"Offroad_ConnectivityNeededPrompt", CLEAR_ON_MANAGER_START}, {"Offroad_InvalidTime", CLEAR_ON_MANAGER_START}, {"Offroad_IsTakingSnapshot", CLEAR_ON_MANAGER_START}, {"Offroad_NeosUpdate", CLEAR_ON_MANAGER_START}, + {"Offroad_NoFirmware", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON}, {"Offroad_StorageMissing", CLEAR_ON_MANAGER_START}, {"Offroad_TemperatureTooHigh", CLEAR_ON_MANAGER_START}, {"Offroad_UnofficialHardware", CLEAR_ON_MANAGER_START}, diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index bd184f200faf78..bbd84d458f1c7d 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -22,7 +22,7 @@ from selfdrive.controls.lib.latcontrol_lqr import LatControlLQR from selfdrive.controls.lib.latcontrol_angle import LatControlAngle from selfdrive.controls.lib.events import Events, ET -from selfdrive.controls.lib.alertmanager import AlertManager +from selfdrive.controls.lib.alertmanager import AlertManager, set_offroad_alert from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.locationd.calibrationd import Calibration from selfdrive.hardware import HARDWARE, TICI, EON @@ -170,6 +170,10 @@ def __init__(self, sm=None, pm=None, can_sock=None): self.events.add(EventName.communityFeatureDisallowed, static=True) if not car_recognized: self.events.add(EventName.carUnrecognized, static=True) + if len(self.CP.carFw) > 0: + set_offroad_alert("Offroad_CarUnrecognized", True) + else: + set_offroad_alert("Offroad_NoFirmware", True) elif self.read_only: self.events.add(EventName.dashcamMode, static=True) elif self.joystick_mode: diff --git a/selfdrive/controls/lib/alerts_offroad.json b/selfdrive/controls/lib/alerts_offroad.json index 9a863551a82811..34f7601b3fa45e 100644 --- a/selfdrive/controls/lib/alerts_offroad.json +++ b/selfdrive/controls/lib/alerts_offroad.json @@ -40,5 +40,13 @@ "Offroad_StorageMissing": { "text": "Storage drive not mounted.", "severity": 1 + }, + "Offroad_CarUnrecognized": { + "text": "openpilot was unable to identify your car... TODO", + "severity": 0 + }, + "Offroad_NoFirmware": { + "text": "openpilot was unable to identify your car (no fw)... TODO", + "severity": 0 } }