controls: write recalibrating offroad alert once (#28312)

* only write once

* rm read

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 715f44ff45
beeps
Shane Smiskol 2 years ago committed by GitHub
parent 44b6640a5f
commit 0189b3fbe6
  1. 5
      selfdrive/controls/controlsd.py

@ -178,6 +178,7 @@ class Controls:
self.desired_curvature_rate = 0.0
self.experimental_mode = False
self.v_cruise_helper = VCruiseHelper(self.CP)
self.recalibrating_seen = False
# TODO: no longer necessary, aside from process replay
self.sm['liveParameters'].valid = True
@ -286,7 +287,9 @@ class Controls:
if cal_status == log.LiveCalibrationData.Status.uncalibrated:
self.events.add(EventName.calibrationIncomplete)
elif cal_status == log.LiveCalibrationData.Status.recalibrating:
set_offroad_alert("Offroad_Recalibration", True)
if not self.recalibrating_seen:
set_offroad_alert("Offroad_Recalibration", True)
self.recalibrating_seen = True
self.events.add(EventName.calibrationRecalibrating)
else:
self.events.add(EventName.calibrationInvalid)

Loading…
Cancel
Save