break canError into two separate events

pull/1593/head
Adeeb Shihadeh 2020-05-29 12:00:29 -07:00
parent 6230f366c5
commit 916448af25
3 changed files with 16 additions and 9 deletions

2
cereal

@ -1 +1 @@
Subproject commit c8be73d10c957bff769998588595107d62e9e738
Subproject commit 0adfc7e77efbf1ebc21bf2629a85d165b319b23e

View File

@ -117,6 +117,7 @@ class Controls:
self.v_cruise_kph_last = 0
self.mismatch_counter = 0
self.can_error_counter = 0
self.consecutive_can_error_count = 0
self.last_blinker_frame = 0
self.saturated_count = 0
self.events_prev = []
@ -188,8 +189,13 @@ class Controls:
LaneChangeState.laneChangeFinishing]:
self.events.add(EventName.laneChange)
if self.can_rcv_error:
if self.can_rcv_error or (not CS.canValid and self.sm.frame > 5 / DT_CTRL):
self.events.add(EventName.canError)
self.consecutive_can_error_count += 1
else:
self.consecutive_can_error_count = 0
if self.consecutive_can_error_count > 2 / DT_CTRL:
self.events.add(EventName.canErrorPersistent)
if self.mismatch_counter >= 200:
self.events.add(EventName.controlsMismatch)
if not self.sm.alive['plan'] and self.sm.alive['pathPlan']:
@ -210,8 +216,6 @@ class Controls:
self.events.add(EventName.radarFault)
if self.sm['plan'].radarCanError:
self.events.add(EventName.radarCanError)
if not CS.canValid and self.sm.frame > 5 / DT_CTRL:
self.events.add(EventName.canError)
if log.HealthData.FaultType.relayMalfunction in self.sm['health'].faults:
self.events.add(EventName.relayMalfunction)
if self.sm['plan'].fcw:

View File

@ -305,6 +305,14 @@ EVENTS = {
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimePrompt, 1., 2., 3.),
},
EventName.canErrorPersistent: {
ET.PERMANENT: Alert(
"CAN Error: Check Connections",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2),
},
# ********** events only containing alerts that display while engaged **********
EventName.vehicleModelInvalid: {
@ -603,11 +611,6 @@ EVENTS = {
EventName.canError: {
ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("CAN Error: Check Connections"),
ET.NO_ENTRY: NoEntryAlert("CAN Error: Check Connections"),
ET.PERMANENT: Alert(
"CAN Error: Check Connections",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2),
},
EventName.steerUnavailable: {