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
10 changes: 1 addition & 9 deletions selfdrive/ui/qt/onroad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) {

NvgWindow::NvgWindow(VisionStreamType type, QWidget* parent) : fps_filter(UI_FREQ, 3, 1. / UI_FREQ), CameraViewWidget("camerad", type, true, parent) {
engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size});
dm_img = loadPixmap("../assets/img_driver_face.png", {img_size, img_size});
}

void NvgWindow::updateState(const UIState &s) {
Expand All @@ -186,13 +185,11 @@ void NvgWindow::updateState(const UIState &s) {
setProperty("speed", QString::number(std::nearbyint(cur_speed)));
setProperty("maxSpeed", maxspeed_str);
setProperty("speedUnit", s.scene.is_metric ? "km/h" : "mph");
setProperty("hideDM", cs.getAlertSize() != cereal::ControlsState::AlertSize::NONE);
setProperty("status", s.status);

// update engageability and DM icons at 2Hz
// update engageability at 2Hz
if (sm.frame % (UI_FREQ / 2) == 0) {
setProperty("engageable", cs.getEngageable() || cs.getEnabled());
setProperty("dmActive", sm["driverMonitoringState"].getDriverMonitoringState().getIsActiveMode());
}
}

Expand Down Expand Up @@ -234,11 +231,6 @@ void NvgWindow::drawHud(QPainter &p) {
engage_img, bg_colors[status], 1.0);
}

// dm icon
if (!hideDM) {
drawIcon(p, radius / 2 + (bdr_s * 2), rect().bottom() - footer_h / 2,
dm_img, QColor(0, 0, 0, 70), dmActive ? 1.0 : 0.2);
}
p.restore();
}

Expand Down
5 changes: 0 additions & 5 deletions selfdrive/ui/qt/onroad.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class NvgWindow : public CameraViewWidget {
Q_PROPERTY(QString maxSpeed MEMBER maxSpeed);
Q_PROPERTY(bool is_cruise_set MEMBER is_cruise_set);
Q_PROPERTY(bool engageable MEMBER engageable);
Q_PROPERTY(bool dmActive MEMBER dmActive);
Q_PROPERTY(bool hideDM MEMBER hideDM);
Q_PROPERTY(int status MEMBER status);

public:
Expand All @@ -45,16 +43,13 @@ class NvgWindow : public CameraViewWidget {
void drawText(QPainter &p, int x, int y, const QString &text, int alpha = 255);

QPixmap engage_img;
QPixmap dm_img;
const int radius = 192;
const int img_size = (radius / 2) * 1.5;
QString speed;
QString speedUnit;
QString maxSpeed;
bool is_cruise_set = false;
bool engageable = false;
bool dmActive = false;
bool hideDM = false;
int status = STATUS_DISENGAGED;

protected:
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void UIState::updateStatus() {
UIState::UIState(QObject *parent) : QObject(parent) {
sm = std::make_unique<SubMaster, const std::initializer_list<const char *>>({
"modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", "roadCameraState",
"pandaStates", "carParams", "driverMonitoringState", "sensorEvents", "carState", "liveLocationKalman",
"pandaStates", "carParams", "sensorEvents", "carState", "liveLocationKalman",
"wideRoadCameraState", "managerState", "navInstruction", "navRoute",
});

Expand Down