startup alert for no fw returned (#21177)

This commit is contained in:
Adeeb Shihadeh
2021-06-07 14:15:09 -07:00
committed by GitHub
parent 29ac94b719
commit d4ab1f1e27
5 changed files with 22 additions and 6 deletions
+1 -1
Submodule cereal updated: 85e1e2f79c...cde8667d3b
+5 -2
View File
@@ -13,14 +13,17 @@ from cereal import car
EventName = car.CarEvent.EventName
def get_startup_event(car_recognized, controller_available, fuzzy_fingerprint):
def get_startup_event(car_recognized, controller_available, fuzzy_fingerprint, fw_seen):
if comma_remote and tested_branch:
event = EventName.startup
else:
event = EventName.startupMaster
if not car_recognized:
event = EventName.startupNoCar
if fw_seen:
event = EventName.startupNoCar
else:
event = EventName.startupNoFw
elif car_recognized and not controller_available:
event = EventName.startupNoControl
elif car_recognized and fuzzy_fingerprint:
+2 -1
View File
@@ -145,7 +145,8 @@ class Controls:
# TODO: no longer necessary, aside from process replay
self.sm['liveParameters'].valid = True
self.startup_event = get_startup_event(car_recognized, controller_available, self.CP.fuzzyFingerprint)
self.startup_event = get_startup_event(car_recognized, controller_available, self.CP.fuzzyFingerprint,
len(self.CP.carFw) > 0)
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
+8
View File
@@ -268,6 +268,14 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
ET.PERMANENT: startup_fuzzy_fingerprint_alert,
},
EventName.startupNoFw: {
ET.PERMANENT: Alert(
"Car Unrecognized",
"Check All Connections",
AlertStatus.userPrompt, AlertSize.mid,
Priority.LOWER, VisualAlert.none, AudibleAlert.none, 0., 0., 15.),
},
EventName.dashcamMode: {
ET.PERMANENT: Alert(
"Dashcam Mode",
+6 -2
View File
@@ -58,9 +58,13 @@ class TestStartup(unittest.TestCase):
(EventName.startupNoControl, MAZDA.CX5, True, CX5_FW_VERSIONS),
(EventName.startupNoControl, MAZDA.CX5, False, CX5_FW_VERSIONS),
# unrecognized car with no fw
(EventName.startupNoFw, None, True, None),
(EventName.startupNoFw, None, False, None),
# unrecognized car
(EventName.startupNoCar, None, True, None),
(EventName.startupNoCar, None, False, None),
(EventName.startupNoCar, None, True, COROLLA_FW_VERSIONS[:1]),
(EventName.startupNoCar, None, False, COROLLA_FW_VERSIONS[:1]),
# fuzzy match
(EventName.startupFuzzyFingerprint, TOYOTA.COROLLA, True, COROLLA_FW_VERSIONS_FUZZY),