ui: grey border and alert when pre-enabling (#24057)

* make border and alert grey when overriding

revert cereal

* no state machine changes

* typo
pull/24061/head
Shane Smiskol 3 years ago committed by GitHub
parent 7c8e8bfd5f
commit 8e34ddc70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      selfdrive/ui/ui.cc
  2. 2
      selfdrive/ui/ui.h

@ -198,10 +198,13 @@ void UIState::updateStatus() {
if (scene.started && sm->updated("controlsState")) {
auto controls_state = (*sm)["controlsState"].getControlsState();
auto alert_status = controls_state.getAlertStatus();
auto state = controls_state.getState();
if (alert_status == cereal::ControlsState::AlertStatus::USER_PROMPT) {
status = STATUS_WARNING;
} else if (alert_status == cereal::ControlsState::AlertStatus::CRITICAL) {
status = STATUS_ALERT;
} else if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED) {
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…
Cancel
Save