diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 0a95ff7bf5..922fa7e36b 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -479,7 +479,11 @@ class Controls: # OVERRIDING elif self.state == State.overriding: - if not self.events.any(ET.OVERRIDE): + if self.events.any(ET.SOFT_DISABLE): + self.state = State.softDisabling + self.soft_disable_timer = int(SOFT_DISABLE_TIME / DT_CTRL) + self.current_alert_types.append(ET.SOFT_DISABLE) + elif not self.events.any(ET.OVERRIDE): self.state = State.enabled else: self.current_alert_types.append(ET.OVERRIDE) diff --git a/selfdrive/controls/tests/test_state_machine.py b/selfdrive/controls/tests/test_state_machine.py index 99a111e612..244c56687c 100755 --- a/selfdrive/controls/tests/test_state_machine.py +++ b/selfdrive/controls/tests/test_state_machine.py @@ -12,11 +12,10 @@ State = log.ControlsState.OpenpilotState # The event types that maintain the current state MAINTAIN_STATES = {State.enabled: None, State.disabled: None, State.softDisabling: ET.SOFT_DISABLE, - State.preEnabled: ET.PRE_ENABLE} -ALL_STATES = tuple((state for state in State.schema.enumerants.values() if - state != State.overriding)) # TODO: remove overriding exception + State.preEnabled: ET.PRE_ENABLE, State.overriding: ET.OVERRIDE} +ALL_STATES = tuple(State.schema.enumerants.values()) # The event types checked in DISABLED section of state machine -ENABLE_EVENT_TYPES = (ET.ENABLE, ET.PRE_ENABLE) +ENABLE_EVENT_TYPES = (ET.ENABLE, ET.PRE_ENABLE, ET.OVERRIDE) def make_event(event_types):