mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-08 20:44:21 +08:00
Compare commits
5 Commits
model-test
...
ui/quiet-m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddebe54541 | ||
|
|
46ab4fd450 | ||
|
|
8ca04b99ee | ||
|
|
21c12fa881 | ||
|
|
22cd9a7867 |
@@ -166,6 +166,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"OnroadUploads", {PERSISTENT | BACKUP, BOOL, "1"}},
|
||||
{"QuickBootToggle", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"QuietMode", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"QuietVisualMode", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"RainbowMode", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"ShowAdvancedControls", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"ShowTurnSignals", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
|
||||
@@ -28,6 +28,13 @@ void DriverMonitorRenderer::updateState(const UIState &s) {
|
||||
auto &sm = *(s.sm);
|
||||
is_visible = sm["selfdriveState"].getSelfdriveState().getAlertSize() == cereal::SelfdriveState::AlertSize::NONE &&
|
||||
sm.rcv_frame("driverStateV2") > s.scene.started_frame;
|
||||
|
||||
#ifdef SUNNYPILOT
|
||||
if (s.scene.quiet_visual_mode) {
|
||||
is_visible = sm["selfdriveState"].getSelfdriveState().getAlertStatus() == cereal::SelfdriveState::AlertStatus::NORMAL &&
|
||||
sm.rcv_frame("driverStateV2") > s.scene.started_frame;
|
||||
}
|
||||
#endif
|
||||
if (!is_visible) return;
|
||||
|
||||
auto dm_state = sm["driverMonitoringState"].getDriverMonitoringState();
|
||||
|
||||
@@ -90,6 +90,13 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
|
||||
"",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"QuietVisualMode",
|
||||
tr("Hide Non-Critical Alerts on UI"),
|
||||
tr("Hide all normal alerts from the UI. Alert chime will still play unless Quiet Mode is on. Critical & User-Confirm alerts will continue to show as usual."),
|
||||
"",
|
||||
false,
|
||||
},
|
||||
};
|
||||
|
||||
// Add regular toggles first
|
||||
|
||||
@@ -20,11 +20,14 @@ OnroadAlerts::Alert OnroadAlertsSP::getAlert(const SubMaster &sm, uint64_t start
|
||||
}
|
||||
|
||||
void OnroadAlertsSP::paintEvent(QPaintEvent *event) {
|
||||
auto s_sp = uiState();
|
||||
if (alert.size == cereal::SelfdriveState::AlertSize::NONE) {
|
||||
return;
|
||||
} else if (alert.size == cereal::SelfdriveState::AlertSize::FULL) {
|
||||
OnroadAlerts::paintEvent(event);
|
||||
return;
|
||||
} else if (s_sp->scene.quiet_visual_mode) {
|
||||
if (alert.status == cereal::SelfdriveState::AlertStatus::NORMAL) return;
|
||||
}
|
||||
static std::map<cereal::SelfdriveState::AlertSize, const int> alert_heights = {
|
||||
{cereal::SelfdriveState::AlertSize::SMALL, 271},
|
||||
@@ -42,7 +45,7 @@ void OnroadAlertsSP::paintEvent(QPaintEvent *event) {
|
||||
int margin = 40;
|
||||
int radius = 30;
|
||||
|
||||
const int dev_ui_info = uiStateSP()->scene.dev_ui_info;
|
||||
const int dev_ui_info = s_sp->scene.dev_ui_info;
|
||||
const int v_adjustment = dev_ui_info > 1 && alert.size != cereal::SelfdriveState::AlertSize::FULL ? 40 : 0;
|
||||
const int h_adjustment = dev_ui_info > 0 && alert.size != cereal::SelfdriveState::AlertSize::FULL ? 230 : 0;
|
||||
|
||||
|
||||
@@ -19,4 +19,7 @@ public:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
Alert getAlert(const SubMaster &sm, uint64_t started_frame);
|
||||
|
||||
private:
|
||||
Params params;
|
||||
};
|
||||
|
||||
@@ -152,8 +152,12 @@ void HudRendererSP::updateState(const UIState &s) {
|
||||
|
||||
speedCluster = car_state.getCruiseState().getSpeedCluster() * speedConv;
|
||||
|
||||
allow_e2e_alerts = sm["selfdriveState"].getSelfdriveState().getAlertSize() == cereal::SelfdriveState::AlertSize::NONE &&
|
||||
sm.rcv_frame("driverStateV2") > s.scene.started_frame && !reversing;
|
||||
allow_e2e_alerts = sm.rcv_frame("driverStateV2") > s.scene.started_frame && !reversing;
|
||||
if (s.scene.quiet_visual_mode) {
|
||||
allow_e2e_alerts &= sm["selfdriveState"].getSelfdriveState().getAlertStatus() == cereal::SelfdriveState::AlertStatus::NORMAL;
|
||||
} else {
|
||||
allow_e2e_alerts &= sm["selfdriveState"].getSelfdriveState().getAlertSize() == cereal::SelfdriveState::AlertSize::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void HudRendererSP::draw(QPainter &p, const QRect &surface_rect) {
|
||||
|
||||
@@ -76,6 +76,8 @@ void ui_update_params_sp(UIStateSP *s) {
|
||||
s->scene.chevron_info = std::atoi(params.get("ChevronInfo").c_str());
|
||||
s->scene.blindspot_ui = params.getBool("BlindSpot");
|
||||
s->scene.rainbow_mode = params.getBool("RainbowMode");
|
||||
|
||||
s->scene.quiet_visual_mode = params.getBool("QuietVisualMode");
|
||||
}
|
||||
|
||||
void UIStateSP::reset_onroad_sleep_timer(OnroadTimerStatusToggle toggleTimerStatus) {
|
||||
|
||||
@@ -21,4 +21,5 @@ typedef struct UISceneSP : UIScene {
|
||||
int chevron_info;
|
||||
bool blindspot_ui;
|
||||
bool rainbow_mode;
|
||||
bool quiet_visual_mode;
|
||||
} UISceneSP;
|
||||
|
||||
Reference in New Issue
Block a user