mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-06 16:55:58 +08:00
ui: grey border and alert when pre-enabling (#24057)
* make border and alert grey when overriding revert cereal * no state machine changes * typo
This commit is contained in:
@@ -198,10 +198,13 @@ void UIState::updateStatus() {
|
|||||||
if (scene.started && sm->updated("controlsState")) {
|
if (scene.started && sm->updated("controlsState")) {
|
||||||
auto controls_state = (*sm)["controlsState"].getControlsState();
|
auto controls_state = (*sm)["controlsState"].getControlsState();
|
||||||
auto alert_status = controls_state.getAlertStatus();
|
auto alert_status = controls_state.getAlertStatus();
|
||||||
|
auto state = controls_state.getState();
|
||||||
if (alert_status == cereal::ControlsState::AlertStatus::USER_PROMPT) {
|
if (alert_status == cereal::ControlsState::AlertStatus::USER_PROMPT) {
|
||||||
status = STATUS_WARNING;
|
status = STATUS_WARNING;
|
||||||
} else if (alert_status == cereal::ControlsState::AlertStatus::CRITICAL) {
|
} else if (alert_status == cereal::ControlsState::AlertStatus::CRITICAL) {
|
||||||
status = STATUS_ALERT;
|
status = STATUS_ALERT;
|
||||||
|
} else if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED) {
|
||||||
|
status = STATUS_OVERRIDE;
|
||||||
} else {
|
} else {
|
||||||
status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
|
status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ struct Alert {
|
|||||||
|
|
||||||
typedef enum UIStatus {
|
typedef enum UIStatus {
|
||||||
STATUS_DISENGAGED,
|
STATUS_DISENGAGED,
|
||||||
|
STATUS_OVERRIDE,
|
||||||
STATUS_ENGAGED,
|
STATUS_ENGAGED,
|
||||||
STATUS_WARNING,
|
STATUS_WARNING,
|
||||||
STATUS_ALERT,
|
STATUS_ALERT,
|
||||||
@@ -80,6 +81,7 @@ typedef enum UIStatus {
|
|||||||
|
|
||||||
const QColor bg_colors [] = {
|
const QColor bg_colors [] = {
|
||||||
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
|
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
|
||||||
|
[STATUS_OVERRIDE] = QColor(0x91, 0x9b, 0x95, 0xf1),
|
||||||
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
|
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
|
||||||
[STATUS_WARNING] = QColor(0xDA, 0x6F, 0x25, 0xf1),
|
[STATUS_WARNING] = QColor(0xDA, 0x6F, 0x25, 0xf1),
|
||||||
[STATUS_ALERT] = QColor(0xC9, 0x22, 0x31, 0xf1),
|
[STATUS_ALERT] = QColor(0xC9, 0x22, 0x31, 0xf1),
|
||||||
|
|||||||
Reference in New Issue
Block a user