diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py index a87539e..8004544 100644 --- a/selfdrive/car/hyundai/hyundaicanfd.py +++ b/selfdrive/car/hyundai/hyundaicanfd.py @@ -38,11 +38,15 @@ class CanBus(CanBusBase): def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer): + # Im sure there is a better way to do this + params_memory = Params("/dev/shm/params") + no_lat_lane_change = params_memory.get_int("no_lat_lane_change", 1) + ret = [] values = { "LKA_MODE": 2, - "LKA_ICON": 2 if enabled else 1 if lat_active else 0, # right mode icon + "LKA_ICON": 0 if no_lat_lane_change else 2 if enabled else 1 if lat_active else 0, # right mode icon "TORQUE_REQUEST": apply_steer, "LKA_ASSIST": 0, "STEER_REQ": 1 if lat_active else 0, @@ -127,18 +131,9 @@ def create_acc_cancel(packer, CP, CAN, cruise_info_copy): # CLEARPILOT changed HDA icons # This doesn't appear to do anything on my tucson def create_lfahda_cluster(packer, CAN, enabled, lat_active): - - # Im sure there is a better way to do this - params = Params() - params_memory = Params("/dev/shm/params") - no_lat_lane_change = params_memory.get_int("no_lat_lane_change", 1) - values = { - # 0 off, 1 gray, 2 green, 3 blinking (wheel icon) - # CP: Is this actually the wheel? Might this be the HDA2 thing? - "HDA_ICON": 0, # Intention is to have this represent stock HDA mode - "LFA_ICON": 0, - # "LFA_ICON": 0 if no_lat_lane_change else 2 if enabled else 1 if lat_active else 0, + "HDA_ICON": 0, + "LFA_ICON": 0 } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 2a311b7..ef6b869 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -46,7 +46,6 @@ static void drawIconGif(QPainter &p, const QPoint ¢er, const QMovie &img, co } OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent), scene(uiState()->scene) { - bg = QColor(255, 0x33, 0x49, 0xc8); // init to a default color QVBoxLayout *main_layout = new QVBoxLayout(this); main_layout->setMargin(UI_BORDER_SIZE); QStackedLayout *stacked_layout = new QStackedLayout; @@ -97,11 +96,6 @@ void OnroadWindow::updateState(const UIState &s) { return; } - QColor bgColor = bg_colors[s.status]; - // Clearpilot - if (paramsMemory.getInt("no_lat_lane_change") == 1) { - bg = bg_colors[STATUS_DISENGAGED]; - } Alert alert = Alert::get(*(s.sm), s.scene.started_frame); alerts->updateAlert(alert); @@ -114,8 +108,12 @@ void OnroadWindow::updateState(const UIState &s) { nvg->updateState(s); + QColor bgColor = bg_colors[s.status]; + if (paramsMemory.getInt("no_lat_lane_change") == 1) { + bgColor = bg_colors[STATUS_DISENGAGED]; + } + if (bg != bgColor) { - // repaint border bg = bgColor; update(); } @@ -639,6 +637,16 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignTop); } + QColor bgColor = bg_colors[s.status]; + if (paramsMemory.getInt("no_lat_lane_change") == 1) { + bgColor = bg_colors[STATUS_DISENGAGED]; + } + + if (bg != bgColor) { + bg = bgColor; + update(); + } + updateFrogPilotWidgets(); } @@ -899,17 +907,12 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { painter.setBrush(path_gradient); painter.drawPolygon(scene.track_vertices); - // Paint path edges ,Use current background color - QColor bgColor = bg_colors[uiState()->status]; - // Clearpilot - if (paramsMemory.getInt("no_lat_lane_change") == 1) { - bgColor = bg_colors[STATUS_DISENGAGED]; - } - if (bgColor != bg_colors[STATUS_DISENGAGED]) { + // Paint path edges ,Use current background color + if (bg != bg_colors[STATUS_DISENGAGED]) { QLinearGradient edge_gradient; - edge_gradient.setColorAt(0.0, QColor(bgColor.red(), bgColor.green(), bgColor.blue(), static_cast(255))); - edge_gradient.setColorAt(0.5, QColor(bgColor.red(), bgColor.green(), bgColor.blue(), static_cast(255 * 0.7) )); - edge_gradient.setColorAt(1.0, QColor(bgColor.red(), bgColor.green(), bg.blue(), static_cast(255 * 0.5))); + edge_gradient.setColorAt(0.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast(255))); + edge_gradient.setColorAt(0.5, QColor(bg.red(), bg.green(), bg.blue(), static_cast(255 * 0.7) )); + edge_gradient.setColorAt(1.0, QColor(bgr.red(), bg.green(), bg.blue(), static_cast(255 * 0.5))); QPainterPath path; path.addPolygon(scene.track_vertices); diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index 9654ac1..81eb3f7 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -193,6 +193,7 @@ private: bool v_ego_cluster_seen = false; int status = STATUS_DISENGAGED; std::unique_ptr pm; + QColor bg = bg_colors[STATUS_DISENGAGED]; int skip_frame_count = 0; bool wide_cam_requested = false; diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 1d56351..af213a4 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -33,7 +33,7 @@ typedef enum UIStatus { } UIStatus; // Clearpilot new alpha constants -const float CENTER_LANE_ALPHA = 0.40; +const float CENTER_LANE_ALPHA = 0.55; const float OTHER_LANE_ALPHA = 0.75; const int CENTER_LANE_WIDTH = 50; @@ -354,7 +354,7 @@ private slots: private: QTimer *timer; bool started_prev = false; - PrimeType prime_type = PrimeType::UNKNOWN; + PrimeType prime_type = PrimeTy pe::UNKNOWN; // FrogPilot variables Params paramsMemory{"/dev/shm/params"};