Compare commits

...

7 Commits

Author SHA1 Message Date
Shane Smiskol 47e0ad3cbe only rename 2022-03-24 10:50:34 -07:00
Shane Smiskol 8c46435630 bump cereal 2022-03-24 10:49:26 -07:00
Shane Smiskol eb48440843 fix 2022-03-24 10:29:49 -07:00
Shane Smiskol 231afe3e6f
clean up 2022-03-23 23:57:40 -07:00
Shane Smiskol 7a3f49db1b
fix logic 2022-03-23 23:57:10 -07:00
Shane Smiskol eab4f8b46e clean up 2022-03-23 21:05:05 -07:00
Shane Smiskol 51e189a272 override state testing 2022-03-23 20:51:23 -07:00
6 changed files with 22 additions and 5 deletions

2
cereal

@ -1 +1 @@
Subproject commit 447d8b8a7a9c75e5f3478ac08622d6f1d2121528
Subproject commit b9d3860541d421189d0973ae57a06eee5c00f556

View File

@ -127,7 +127,7 @@ class CarInterfaceBase(ABC):
if cs_out.espDisabled:
events.add(EventName.espDisabled)
if cs_out.gasPressed:
events.add(EventName.gasPressed)
events.add(EventName.gasPressedPreEnable)
if cs_out.stockFcw:
events.add(EventName.stockFcw)
if cs_out.stockAeb:

View File

@ -431,6 +431,9 @@ class Controls:
self.soft_disable_timer = int(SOFT_DISABLE_TIME / DT_CTRL)
self.current_alert_types.append(ET.SOFT_DISABLE)
elif self.events.any(ET.OVERRIDE):
self.state = State.overriding
# SOFT DISABLING
elif self.state == State.softDisabling:
if not self.events.any(ET.SOFT_DISABLE):
@ -450,6 +453,13 @@ class Controls:
else:
self.current_alert_types.append(ET.PRE_ENABLE)
# OVERRIDING
elif self.state == State.overriding:
if not self.events.any(ET.OVERRIDE):
self.state = State.enabled
else:
self.current_alert_types.append(ET.OVERRIDE)
# DISABLED
elif self.state == State.disabled:
if self.events.any(ET.ENABLE):
@ -459,6 +469,8 @@ class Controls:
else:
if self.events.any(ET.PRE_ENABLE):
self.state = State.preEnabled
elif self.events.any(ET.OVERRIDE):
self.state = State.overriding
else:
self.state = State.enabled
self.current_alert_types.append(ET.ENABLE)
@ -466,7 +478,7 @@ class Controls:
self.v_cruise_kph = initialize_v_cruise(CS.vEgo, CS.buttonEvents, self.v_cruise_kph_last)
# Check if actuators are enabled
self.active = self.state in (State.enabled, State.softDisabling)
self.active = self.state in (State.enabled, State.overriding, State.softDisabling)
if self.active:
self.current_alert_types.append(ET.WARNING)

View File

@ -30,6 +30,7 @@ class Priority(IntEnum):
class ET:
ENABLE = 'enable'
PRE_ENABLE = 'preEnable'
OVERRIDE = 'override'
NO_ENTRY = 'noEntry'
WARNING = 'warning'
USER_DISABLE = 'userDisable'
@ -356,11 +357,11 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
# ********** events only containing alerts that display while engaged **********
EventName.gasPressed: {
EventName.gasPressedPreEnable: {
ET.PRE_ENABLE: Alert(
"Release Gas Pedal to Engage",
"",
AlertStatus.normal, AlertSize.small,
AlertStatus.override, AlertSize.small,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1, creation_delay=1.),
},

View File

@ -202,6 +202,8 @@ void UIState::updateStatus() {
status = STATUS_WARNING;
} else if (alert_status == cereal::ControlsState::AlertStatus::CRITICAL) {
status = STATUS_ALERT;
} else if (alert_status == cereal::ControlsState::AlertStatus::OVERRIDE) {
status = STATUS_OVERRIDE;
} else {
status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
}

View File

@ -73,6 +73,7 @@ struct Alert {
typedef enum UIStatus {
STATUS_DISENGAGED,
STATUS_OVERRIDE,
STATUS_ENGAGED,
STATUS_WARNING,
STATUS_ALERT,
@ -80,6 +81,7 @@ typedef enum UIStatus {
const QColor bg_colors [] = {
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
[STATUS_OVERRIDE] = QColor(0x91, 0x9b, 0x95, 0xf1),
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
[STATUS_WARNING] = QColor(0xDA, 0x6F, 0x25, 0xf1),
[STATUS_ALERT] = QColor(0xC9, 0x22, 0x31, 0xf1),