startup alert for no fw returned (#21177)

old-commit-hash: d4ab1f1e27
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent baa85548de
commit 5dfc430d47
  1. 2
      cereal
  2. 7
      selfdrive/car/car_helpers.py
  3. 3
      selfdrive/controls/controlsd.py
  4. 8
      selfdrive/controls/lib/events.py
  5. 8
      selfdrive/controls/tests/test_startup.py

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

@ -13,14 +13,17 @@ from cereal import car
EventName = car.CarEvent.EventName 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: if comma_remote and tested_branch:
event = EventName.startup event = EventName.startup
else: else:
event = EventName.startupMaster event = EventName.startupMaster
if not car_recognized: if not car_recognized:
event = EventName.startupNoCar if fw_seen:
event = EventName.startupNoCar
else:
event = EventName.startupNoFw
elif car_recognized and not controller_available: elif car_recognized and not controller_available:
event = EventName.startupNoControl event = EventName.startupNoControl
elif car_recognized and fuzzy_fingerprint: elif car_recognized and fuzzy_fingerprint:

@ -145,7 +145,8 @@ class Controls:
# TODO: no longer necessary, aside from process replay # TODO: no longer necessary, aside from process replay
self.sm['liveParameters'].valid = True 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: if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True) self.events.add(EventName.soundsUnavailable, static=True)

@ -268,6 +268,14 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
ET.PERMANENT: startup_fuzzy_fingerprint_alert, 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: { EventName.dashcamMode: {
ET.PERMANENT: Alert( ET.PERMANENT: Alert(
"Dashcam Mode", "Dashcam Mode",

@ -58,9 +58,13 @@ class TestStartup(unittest.TestCase):
(EventName.startupNoControl, MAZDA.CX5, True, CX5_FW_VERSIONS), (EventName.startupNoControl, MAZDA.CX5, True, CX5_FW_VERSIONS),
(EventName.startupNoControl, MAZDA.CX5, False, 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 # unrecognized car
(EventName.startupNoCar, None, True, None), (EventName.startupNoCar, None, True, COROLLA_FW_VERSIONS[:1]),
(EventName.startupNoCar, None, False, None), (EventName.startupNoCar, None, False, COROLLA_FW_VERSIONS[:1]),
# fuzzy match # fuzzy match
(EventName.startupFuzzyFingerprint, TOYOTA.COROLLA, True, COROLLA_FW_VERSIONS_FUZZY), (EventName.startupFuzzyFingerprint, TOYOTA.COROLLA, True, COROLLA_FW_VERSIONS_FUZZY),

Loading…
Cancel
Save