Compare commits
7 Commits
master
...
override-a
Author | SHA1 | Date |
---|---|---|
Shane Smiskol | 47e0ad3cbe | |
Shane Smiskol | 8c46435630 | |
Shane Smiskol | eb48440843 | |
Shane Smiskol | 231afe3e6f | |
Shane Smiskol | 7a3f49db1b | |
Shane Smiskol | eab4f8b46e | |
Shane Smiskol | 51e189a272 |
2
cereal
2
cereal
|
@ -1 +1 @@
|
|||
Subproject commit 447d8b8a7a9c75e5f3478ac08622d6f1d2121528
|
||||
Subproject commit b9d3860541d421189d0973ae57a06eee5c00f556
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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.),
|
||||
},
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue