controls: preEnabled doesn't consider noEntry (#26627)

preEnabled doesn't consider noEntry
pull/26630/head^2
Shane Smiskol 2 years ago committed by GitHub
parent 712b9014d7
commit 8ad8d4e1c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      selfdrive/controls/controlsd.py
  2. 6
      selfdrive/controls/tests/test_state_machine.py

@ -518,10 +518,7 @@ class Controls:
# PRE ENABLING
elif self.state == State.preEnabled:
if self.events.any(ET.NO_ENTRY):
self.state = State.disabled
self.current_alert_types.append(ET.NO_ENTRY)
elif not self.events.any(ET.PRE_ENABLE):
if not self.events.any(ET.PRE_ENABLE):
self.state = State.enabled
else:
self.current_alert_types.append(ET.PRE_ENABLE)

@ -79,7 +79,7 @@ class TestStateMachine(unittest.TestCase):
self.assertEqual(self.controlsd.state, State.disabled)
def test_no_entry(self):
# disabled with enable events
# Make sure noEntry keeps us disabled
for et in ENABLE_EVENT_TYPES:
self.controlsd.events.add(make_event([ET.NO_ENTRY, et]))
self.controlsd.state_transition(self.CS)
@ -87,11 +87,11 @@ class TestStateMachine(unittest.TestCase):
self.controlsd.events.clear()
def test_no_entry_pre_enable(self):
# preEnabled with preEnabled event
# preEnabled with noEntry event
self.controlsd.state = State.preEnabled
self.controlsd.events.add(make_event([ET.NO_ENTRY, ET.PRE_ENABLE]))
self.controlsd.state_transition(self.CS)
self.assertEqual(self.controlsd.state, State.disabled)
self.assertEqual(self.controlsd.state, State.preEnabled)
def test_maintain_states(self):
# Given current state's event type, we should maintain state

Loading…
Cancel
Save