Present alert if fan isn't spinning (#2258)

* Present alert if fan isn't spinning

* allow entry

* Small updates

Moving to fan malfunction event

Only trigger event for uno or dos

* Changed checking fanSpeed > 50%

* Update text for fan malfunction alert.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Alert if fan isn't spinning for 5 sec

* Alert edit

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 1a2efdc139868f3588a4a35505e8833eacee735d
This commit is contained in:
Logan Lasiter
2020-10-07 03:15:09 -07:00
committed by GitHub
parent 1a2893345a
commit dd0c9d0796
2 changed files with 17 additions and 2 deletions
+9
View File
@@ -121,6 +121,7 @@ class Controls:
self.last_blinker_frame = 0
self.saturated_count = 0
self.distance_traveled = 0
self.last_functional_fan_frame = 0
self.events_prev = []
self.current_alert_types = [ET.PERMANENT]
@@ -171,6 +172,14 @@ class Controls:
if self.sm['thermal'].memUsedPercent > 90:
self.events.add(EventName.lowMemory)
# Alert if fan isn't spinning for 5 seconds
if self.sm['health'].hwType in [HwType.uno, HwType.dos]:
if self.sm['health'].fanSpeedRpm == 0 and self.sm['thermal'].fanSpeed > 50:
if (self.sm.frame - self.last_functional_fan_frame) * DT_CTRL > 5.0:
self.events.add(EventName.fanMalfunction)
else:
self.last_functional_fan_frame = self.sm.frame
# Handle calibration status
cal_status = self.sm['liveCalibration'].calStatus
if cal_status != Calibration.CALIBRATED:
+8 -2
View File
@@ -211,8 +211,6 @@ def wrong_car_mode_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: boo
EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, bool], Alert]]]] = {
# ********** events with no alerts **********
EventName.fanMalfunction: {},
# ********** events only containing alerts displayed in all states **********
EventName.debugAlert: {
@@ -471,6 +469,14 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimePrompt, 1., 2., 3.),
},
EventName.fanMalfunction: {
ET.PERMANENT: Alert(
"Fan Malfunction",
"Contact Support",
AlertStatus.normal, AlertSize.mid,
Priority.LOWER, VisualAlert.none, AudibleAlert.none, 0., 0., .2)
},
# ********** events that affect controls state transitions **********
EventName.pcmEnable: {