diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 45bf41ba2d..482f04c032 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -196,6 +196,7 @@ void NvgWindow::updateState(const UIState &s) { setProperty("has_eu_speed_limit", nav_alive && speed_limit_sign == cereal::NavInstruction::SpeedLimitSign::VIENNA); setProperty("is_cruise_set", cruise_set); + setProperty("is_metric", s.scene.is_metric); setProperty("speed", cur_speed); setProperty("setSpeed", set_speed); setProperty("speedUnit", s.scene.is_metric ? "km/h" : "mph"); @@ -225,8 +226,8 @@ void NvgWindow::drawHud(QPainter &p) { // Draw outer box + border to contain set speed and speed limit int default_rect_width = 172; int rect_width = default_rect_width; + if (is_metric || has_eu_speed_limit) rect_width = 200; if (has_us_speed_limit && speedLimitStr.size() >= 3) rect_width = 223; - else if (has_eu_speed_limit) rect_width = 200; int rect_height = 204; if (has_us_speed_limit) rect_height = 402; diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index e58d7a7972..4cd88fc9e3 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -34,6 +34,7 @@ class NvgWindow : public CameraViewWidget { Q_PROPERTY(bool is_cruise_set MEMBER is_cruise_set); Q_PROPERTY(bool has_eu_speed_limit MEMBER has_eu_speed_limit); Q_PROPERTY(bool has_us_speed_limit MEMBER has_us_speed_limit); + Q_PROPERTY(bool is_metric MEMBER is_metric); Q_PROPERTY(bool engageable MEMBER engageable); Q_PROPERTY(bool dmActive MEMBER dmActive); @@ -57,6 +58,7 @@ private: float setSpeed; float speedLimit; bool is_cruise_set = false; + bool is_metric = false; bool engageable = false; bool dmActive = false; bool hideDM = false;