mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 22:42:05 +08:00
tests: add overriding to state machine test (#24131)
* add overriding to state machine test * overriding should consider soft disable too
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user