handle DM icon (and test)

pull/29068/head
Shane Smiskol 2 years ago
parent c097750b21
commit 6651c8b1fc
  1. 1
      common/params.cc
  2. 20
      selfdrive/ui/qt/onroad.cc
  3. 1
      selfdrive/ui/qt/onroad.h

@ -85,6 +85,7 @@ private:
std::unordered_map<std::string, uint32_t> keys = {
{"AccessToken", CLEAR_ON_MANAGER_START | DONT_LOG},
{"Test", PERSISTENT},
{"ApiCache_Device", PERSISTENT},
{"ApiCache_DriveStats", PERSISTENT},
{"ApiCache_NavDestinations", PERSISTENT},

@ -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<PubMaster, const std::initializer_list<const char *>>({"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) {

@ -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;

Loading…
Cancel
Save