DM: fix always on permanent lockout (#35834)

fix check and comments
pull/35835/head^2
Shane Smiskol 1 month ago committed by GitHub
parent 18970781ba
commit 64d8be9176
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      selfdrive/monitoring/helpers.py

@ -309,15 +309,15 @@ class DriverMonitoring:
def _update_events(self, driver_engaged, op_engaged, standstill, wrong_gear, car_speed):
self._reset_events()
# Block engaging after max number of distrations or when alert active
# Block engaging until ignition cycle after max number or time of distractions
if self.terminal_alert_cnt >= self.settings._MAX_TERMINAL_ALERTS or \
self.terminal_time >= self.settings._MAX_TERMINAL_DURATION or \
self.always_on and self.awareness <= self.threshold_prompt:
self.terminal_time >= self.settings._MAX_TERMINAL_DURATION:
if not self.too_distracted:
self.params.put_bool_nonblocking("DriverTooDistracted", True)
self.too_distracted = True
if self.too_distracted:
# Always-on distraction lockout is temporary
if self.too_distracted or (self.always_on and self.awareness <= self.threshold_prompt):
self.current_events.add(EventName.tooDistracted)
always_on_valid = self.always_on and not wrong_gear

Loading…
Cancel
Save