From c981eb3057c5c46bb3d56420c946c44101b9ffd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=BA=E6=A2=B0=E5=B0=8F=E9=B8=BD?= <128568434+jixiexiaoge@users.noreply.github.com> Date: Sat, 1 Mar 2025 22:11:48 +0800 Subject: [PATCH] UI add SpeedFromPCM --- selfdrive/ui/carrot.cc | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/selfdrive/ui/carrot.cc b/selfdrive/ui/carrot.cc index 0cdb141..6153bb9 100644 --- a/selfdrive/ui/carrot.cc +++ b/selfdrive/ui/carrot.cc @@ -219,8 +219,8 @@ static inline void fill_rect(NVGcontext* vg, const Rect1& r, const NVGcolor* col if (stroke_width > 0) { nvgStrokeWidth(vg, stroke_width); if (stroke_color) nvgStrokeColor(vg, *stroke_color); - else nvgStrokeColor(vg, nvgRGB(0, 0, 0)); - nvgStroke(vg); + else nvgStrokeColor(vg, nvgRGB(0, 0, 0)); + nvgStroke(vg); } } @@ -1117,7 +1117,7 @@ public: return; } const auto carrot_man = sm["carrotMan"].getCarrotMan(); - + active_carrot = carrot_man.getActiveCarrot(); if (active_carrot > 1) { @@ -1141,7 +1141,7 @@ public: szSdiDescr = QString::fromStdString(carrot_man.getSzSdiDescr()); szPosRoadName = QString::fromStdString(carrot_man.getSzPosRoadName()); szTBTMainText = QString::fromStdString(carrot_man.getSzTBTMainText()); - + } else { xTurnInfo = -1; @@ -1918,7 +1918,7 @@ public: int max_z = lane_lines[2].getZ().size(); float z_offset = 0.0; foreach(const QString & pair, pairs) { - QStringList xy = pair.split(","); // ","로 x와 y 구분 + QStringList xy = pair.split(","); // ","로 x와 y 구분 if (xy.size() == 3) { //printf("coords = x: %.1f, y: %.1f, d:%.1f\n", xy[0].toFloat(), xy[1].toFloat(), xy[2].toFloat()); float x = xy[0].toFloat(); @@ -2613,7 +2613,7 @@ void ui_draw(UIState *s, ModelRenderer* model_renderer, int w, int h) { int path_x = drawPathEnd.getPathX(); int path_y = drawPathEnd.getPathY(); drawDesire.draw(s, path_x, path_y - 135); - + drawPlot.draw(s); @@ -2751,8 +2751,30 @@ public: strcpy(bottom, str.toStdString().c_str()); // bottom_left + // CSLC (Custom Speed Limit Control): 自定义速度限制控制 + // MRCC (Mazda Radar Cruise Control): 马自达雷达巡航控制 + // OPCS (OpenPilot Control System): OpenPilot 控制系统 + // FCM: 其他车型的速度模式显示 + QString gitBranch = QString::fromStdString(params.get("GitBranch")); - sprintf(bottom_left, "%s", gitBranch.toStdString().c_str()); + int speedFromPCM = params.getInt("SpeedFromPCM"); + + switch (speedFromPCM) { + case 0: + sprintf(bottom_left, "%s - CSLC", gitBranch.toStdString().c_str()); + break; + case 1: + sprintf(bottom_left, "%s - MRCC", gitBranch.toStdString().c_str()); + break; + case 2: + sprintf(bottom_left, "%s - OPCS", gitBranch.toStdString().c_str()); + break; + default: + sprintf(bottom_left, "%s", gitBranch.toStdString().c_str()); + break; + + + } // bottom_right Params params_memory = Params("/dev/shm/params");