Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"dp_toyota_enhanced_bsm", PERSISTENT},
{"dp_toyota_auto_lock", PERSISTENT},
{"dp_toyota_auto_unlock", PERSISTENT},
{"dp_device_display_off_mode", PERSISTENT},
{"dp_device_audible_alert_mode", PERSISTENT},
{"dp_device_disable_temp_check", PERSISTENT},
{"dp_car_dashcam_mode_removal", PERSISTENT},
Expand Down
1 change: 1 addition & 0 deletions selfdrive/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def manager_init() -> None:
("dp_toyota_enhanced_bsm", "0"),
("dp_toyota_auto_lock", "0"),
("dp_toyota_auto_unlock", "0"),
("dp_device_display_off_mode", "0"),
("dp_device_audible_alert_mode", "0"),
("dp_device_disable_temp_check", "0"),
("dp_car_dashcam_mode_removal", "0"),
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/qt/offroad/settings_dp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ void DPCtrlPanel::add_device_toggles() {
},
};

std::vector<QString> display_off_mode_texts{tr("Standard"), tr("On-Road"), tr("MAIN"), tr("OP")};
ButtonParamControl* display_off_mode_setting = new ButtonParamControl("dp_device_display_off_mode", tr("Display Mode"),
tr("Standard - Standard behaviour.\nOn-Road - When driving, the display will be off (excl. warning).\nMAIN - When ACC MAIN is on, the display will be off (excl. warning).\nOP - When OP is enabled, the display will be off (excl. warning).\nReboot required."),
"",
display_off_mode_texts);

std::vector<QString> audible_alert_mode_texts{tr("Standard"), tr("Warning"), tr("Off")};
ButtonParamControl* audible_alert_mode_setting = new ButtonParamControl("dp_device_audible_alert_mode", tr("Audible Alert Mode"),
tr("Standard - Standard behaviour.\nWarning - Only emits sound when there is a warning.\nOff - Does not emit any sound at all."),
Expand Down Expand Up @@ -230,6 +236,8 @@ void DPCtrlPanel::add_device_toggles() {
});
auto_shutdown_timer_toggle->setVisible(false);
addItem(auto_shutdown_timer_toggle);
// display off mode
addItem(display_off_mode_setting);
// audible alert mode
addItem(audible_alert_mode_setting);
}
Expand Down
35 changes: 34 additions & 1 deletion selfdrive/ui/ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ UIState::UIState(QObject *parent) : QObject(parent) {
prime_type = std::atoi(params.get("PrimeType").c_str());
language = QString::fromStdString(params.get("LanguageSetting"));

dp_device_display_off_mode = std::atoi(params.get("dp_device_display_off_mode").c_str());

// update timer
timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
Expand Down Expand Up @@ -421,7 +423,38 @@ void Device::updateWakefulness(const UIState &s) {
emit interactiveTimeout();
}

setAwake(s.scene.ignition || interactive_timeout > 0);
// rick - display mode
// tr("Disabled"), tr("On-Road") tr("MAIN"), tr("OP"), tr("Off")}
if (s.scene.ignition && s.dp_device_display_off_mode > 0) {
// Off - the display will be off completely (incl. warning).

const SubMaster &sm = *(s.sm);
auto cs = sm["carState"].getCarState().getCruiseState();
Alert alert = Alert::get(*(s.sm), s.scene.started_frame);
// if there is a warning, always show screen
if (alert.status == cereal::ControlsState::AlertStatus::USER_PROMPT || alert.status == cereal::ControlsState::AlertStatus::CRITICAL) {
resetInteractiveTimeout();
// op - When OP is enabled, the display will be off
} else if (s.dp_device_display_off_mode == 3) {
if (!cs.getEnabled()) {
resetInteractiveTimeout();
}
// main - When ACC MAIN is on, the display will be off
} else if (s.dp_device_display_off_mode == 2) {
if (!cs.getAvailable()) {
resetInteractiveTimeout();
}
// on-road - When driving, the display will be off
} else if (s.dp_device_display_off_mode == 1) {
if (!s.scene.ignition) {
resetInteractiveTimeout();
}
}
setAwake(interactive_timeout > 0);
} else {
setAwake(s.scene.ignition || interactive_timeout > 0);
}
// setAwake(s.scene.ignition || interactive_timeout > 0);
}

UIState *uiState() {
Expand Down
1 change: 1 addition & 0 deletions selfdrive/ui/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class UIState : public QObject {
UIScene scene = {};

QString language;
int dp_device_display_off_mode = 0;

QTransform car_space_transform;

Expand Down
Loading