diff --git a/common/params.cc b/common/params.cc index 509d419d64..bc548d783b 100644 --- a/common/params.cc +++ b/common/params.cc @@ -85,6 +85,7 @@ private: std::unordered_map keys = { {"AccessToken", CLEAR_ON_MANAGER_START | DONT_LOG}, + {"Test", PERSISTENT}, {"ApiCache_Device", PERSISTENT}, {"ApiCache_DriveStats", PERSISTENT}, {"ApiCache_NavDestinations", PERSISTENT}, diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 586a5d7e9a..9b8fb53b7f 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -252,7 +252,7 @@ void MapSettingsButton::paintEvent(QPaintEvent *event) { AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* parent) : fps_filter(UI_FREQ, 3, 1. / UI_FREQ), CameraWidget("camerad", type, true, parent) { pm = std::make_unique>({"uiDebug"}); - QVBoxLayout *main_layout = new QVBoxLayout(this); + main_layout = new QVBoxLayout(this); main_layout->setMargin(UI_BORDER_SIZE); main_layout->setSpacing(0); @@ -309,20 +309,22 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { setProperty("hideBottomIcons", (cs.getAlertSize() != cereal::ControlsState::AlertSize::NONE)); setProperty("status", s.status); + // update DM icon + auto dm_state = sm["driverMonitoringState"].getDriverMonitoringState(); + setProperty("dmActive", dm_state.getIsActiveMode()); +// setProperty("rightHandDM", dm_state.getIsRHD()); + setProperty("rightHandDM", Params().getBool("Test")); + // DM icon transition + dm_fade_state = std::clamp(dm_fade_state+0.2*(0.5-dmActive), 0.0, 1.0); + // update engageability/experimental mode button experimental_btn->updateState(s); - // hide map settings button for alerts + // hide map settings button for alerts and flip for right hand DM if (map_settings_btn->isEnabled()) { map_settings_btn->setVisible(!hideBottomIcons); + main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignBottom); } - - // update DM icon - auto dm_state = sm["driverMonitoringState"].getDriverMonitoringState(); - setProperty("dmActive", dm_state.getIsActiveMode()); - setProperty("rightHandDM", dm_state.getIsRHD()); - // DM icon transition - dm_fade_state = std::clamp(dm_fade_state+0.2*(0.5-dmActive), 0.0, 1.0); } void AnnotatedCameraWidget::drawHud(QPainter &p) { diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index b21d36f7ed..0dd95877a0 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -87,6 +87,7 @@ private: void drawIcon(QPainter &p, int x, int y, QPixmap &img, QBrush bg, float opacity); void drawText(QPainter &p, int x, int y, const QString &text, int alpha = 255); + QVBoxLayout *main_layout; ExperimentalButton *experimental_btn; QPixmap dm_img; float speed;