diff --git a/selfdrive/ui/qt/onroad/onroad_home.cc b/selfdrive/ui/qt/onroad/onroad_home.cc index 652bca5d0..f4ff62227 100644 --- a/selfdrive/ui/qt/onroad/onroad_home.cc +++ b/selfdrive/ui/qt/onroad/onroad_home.cc @@ -84,6 +84,14 @@ void OnroadWindow::updateState(const UIState &s) { // FrogPilot variables const UIScene &scene = s.scene; + blindSpotLeft = scene.blind_spot_left; + blindSpotRight = scene.blind_spot_right; + showBlindspot = scene.show_blind_spot && (blindSpotLeft || blindSpotRight); + + if (showBlindspot) { + shouldUpdate = true; + } + if (shouldUpdate) { update(); } @@ -203,4 +211,25 @@ void OnroadWindow::paintEvent(QPaintEvent *event) { QRect rect = this->rect(); QColor bgColor(bg.red(), bg.green(), bg.blue(), 255); p.fillRect(rect, bgColor); + + if (showBlindspot) { + QColor blindspotColorLeft = bgColor; + QColor blindspotColorRight = bgColor; + + if (blindSpotLeft) { + blindspotColorLeft = bg_colors[STATUS_TRAFFIC_MODE_ACTIVE]; + } + + if (blindSpotRight) { + blindspotColorRight = bg_colors[STATUS_TRAFFIC_MODE_ACTIVE]; + } + + int xLeft = rect.x(); + int xRight = rect.x() + rect.width() / 2; + QRect blindspotRectLeft(xLeft, rect.y(), rect.width() / 2, rect.height()); + QRect blindspotRectRight(xRight, rect.y(), rect.width() / 2, rect.height()); + + p.fillRect(blindspotRectLeft, blindspotColorLeft); + p.fillRect(blindspotRectRight, blindspotColorRight); + } } diff --git a/selfdrive/ui/qt/onroad/onroad_home.h b/selfdrive/ui/qt/onroad/onroad_home.h index c903c36cf..509fb7fb1 100644 --- a/selfdrive/ui/qt/onroad/onroad_home.h +++ b/selfdrive/ui/qt/onroad/onroad_home.h @@ -25,6 +25,10 @@ private: QHBoxLayout* split; // FrogPilot variables + bool blindSpotLeft; + bool blindSpotRight; + bool showBlindspot; + QPoint timeoutPoint = QPoint(420, 69); QTimer clickTimer; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 5a0c8ceb4..04fabec1a 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -338,6 +338,10 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { scene.holiday_themes = custom_theme && params.getBool("HolidayThemes"); scene.random_events = custom_theme && params.getBool("RandomEvents"); + bool developer_ui = params.getBool("DeveloperUI"); + bool border_metrics = developer_ui && params.getBool("BorderMetrics"); + scene.show_blind_spot = border_metrics && params.getBool("BlindSpotMetrics"); + scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing"); scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 97d9325b8..a404ad21c 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -155,6 +155,7 @@ typedef struct UIScene { bool road_name_ui; bool rotating_wheel; bool show_aol_status_bar; + bool show_blind_spot; bool show_cem_status_bar; bool show_slc_offset; bool show_slc_offset_ui;