From 20ea43f317013e4edb09d8d22e2e542444760399 Mon Sep 17 00:00:00 2001 From: Brian Hanson Date: Mon, 4 May 2026 19:07:54 -0500 Subject: [PATCH] nightrider: render lane-change UI (was hidden by disengaged-skip) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During a lane change controlsd writes no_lat_lane_change=true; OnroadWindow forces edgeColor to STATUS_DISENGAGED so the bg color flips to the disengaged hue. drawLaneLines's nightrider early-return ("hide all when disengaged") was matching that and skipping the entire frame, so nightrider showed nothing during the lane change. Fixes: - Hoist is_no_lat_lane_change above the early-return. - Skip the early-return during lane change, so lane lines + road edges + blind-spot path still render in nightrider while the maneuver is active (matching how nightrider looks when normally engaged). - In the outline-only track-polygon branch: when in lane change, draw the track as a 4 px outline of CHANGE_LANE_PATH_COLOR (the same yellow used to fill the polygon in normal mode) instead of the usual 3 px light-blue guide. Hollow shape, thicker stroke — matches Brian's spec. Normal-mode rendering is unchanged. --- selfdrive/ui/qt/onroad.cc | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 558d02e..9de2b6d 100755 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -851,8 +851,15 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // CLEARPILOT: nightrider mode — outline only, no fill bool outlineOnly = nightriderMode; - // CLEARPILOT: in nightrider mode, hide all lines when not engaged - if (outlineOnly && edgeColor == bg_colors[STATUS_DISENGAGED]) { + // CLEARPILOT: read here so the nightrider hide-when-disengaged check below + // can let lane-change frames through (controlsd forces edgeColor to + // STATUS_DISENGAGED while no_lat_lane_change is true). + bool is_no_lat_lane_change = paramsMemory.getBool("no_lat_lane_change"); + + // CLEARPILOT: in nightrider mode, hide all lines when not engaged — except + // during a lane change, where we still want lane lines + road edges drawn + // alongside the yellow lane-change outline. + if (outlineOnly && edgeColor == bg_colors[STATUS_DISENGAGED] && !is_no_lat_lane_change) { painter.restore(); return; } @@ -893,8 +900,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // paint center lane path // QColor bg_colors[CHANGE_LANE_PATH_COLOR]; - // CLEARPILOT: read from paramsMemory; controlsd writes "no_lat_lane_change". - bool is_no_lat_lane_change = paramsMemory.getBool("no_lat_lane_change"); + // is_no_lat_lane_change was read at the top of this function. QColor center_lane_color; @@ -955,11 +961,17 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { } if (outlineOnly) { - // CLEARPILOT: in nightrider, the tire path outline is light blue at 3px. - // Uses a fixed light-blue instead of center_lane_color (which is status-tinted) so - // the path reads as a neutral guide, not as engagement/status feedback. - QColor lightBlue(153, 204, 255, 220); // #99CCFF light blue, mostly opaque - painter.setPen(QPen(lightBlue, 3)); + // CLEARPILOT: in nightrider, the tire path is rendered as an outline. + // - Normal: light blue 3px (status-neutral guide) + // - Lane change: 4px outline of CHANGE_LANE_PATH_COLOR (the same yellow + // used to fill the polygon in normal mode), so the nightrider lane + // change reads as the same visual cue, just hollow. + if (is_no_lat_lane_change) { + painter.setPen(QPen(bg_colors[CHANGE_LANE_PATH_COLOR], 4)); + } else { + QColor lightBlue(153, 204, 255, 220); // #99CCFF light blue, mostly opaque + painter.setPen(QPen(lightBlue, 3)); + } painter.setBrush(Qt::NoBrush); } else { painter.setPen(Qt::NoPen);