startup alert for no fw returned (#21177)

pull/21179/head^2
Adeeb Shihadeh 2021-06-07 14:15:09 -07:00 committed by GitHub
parent 29ac94b719
commit d4ab1f1e27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 6 deletions

2
cereal

@ -1 +1 @@
Subproject commit 85e1e2f79cffc4df307e29b118a76adc4226b52f
Subproject commit cde8667d3bacb71d324b06b3d803c8fd7c59d2db

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:

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)

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",

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),