UI add SpeedFromPCM

This commit is contained in:
机械小鸽 2025-03-01 22:11:48 +08:00 committed by GitHub
parent aacaef9a2c
commit c981eb3057
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -219,8 +219,8 @@ static inline void fill_rect(NVGcontext* vg, const Rect1& r, const NVGcolor* col
if (stroke_width > 0) { if (stroke_width > 0) {
nvgStrokeWidth(vg, stroke_width); nvgStrokeWidth(vg, stroke_width);
if (stroke_color) nvgStrokeColor(vg, *stroke_color); if (stroke_color) nvgStrokeColor(vg, *stroke_color);
else nvgStrokeColor(vg, nvgRGB(0, 0, 0)); else nvgStrokeColor(vg, nvgRGB(0, 0, 0));
nvgStroke(vg); nvgStroke(vg);
} }
} }
@ -1117,7 +1117,7 @@ public:
return; return;
} }
const auto carrot_man = sm["carrotMan"].getCarrotMan(); const auto carrot_man = sm["carrotMan"].getCarrotMan();
active_carrot = carrot_man.getActiveCarrot(); active_carrot = carrot_man.getActiveCarrot();
if (active_carrot > 1) { if (active_carrot > 1) {
@ -1141,7 +1141,7 @@ public:
szSdiDescr = QString::fromStdString(carrot_man.getSzSdiDescr()); szSdiDescr = QString::fromStdString(carrot_man.getSzSdiDescr());
szPosRoadName = QString::fromStdString(carrot_man.getSzPosRoadName()); szPosRoadName = QString::fromStdString(carrot_man.getSzPosRoadName());
szTBTMainText = QString::fromStdString(carrot_man.getSzTBTMainText()); szTBTMainText = QString::fromStdString(carrot_man.getSzTBTMainText());
} }
else { else {
xTurnInfo = -1; xTurnInfo = -1;
@ -1918,7 +1918,7 @@ public:
int max_z = lane_lines[2].getZ().size(); int max_z = lane_lines[2].getZ().size();
float z_offset = 0.0; float z_offset = 0.0;
foreach(const QString & pair, pairs) { foreach(const QString & pair, pairs) {
QStringList xy = pair.split(","); // ","로 x와 y 구분 QStringList xy = pair.split(","); // ","로 x와 y 구분
if (xy.size() == 3) { if (xy.size() == 3) {
//printf("coords = x: %.1f, y: %.1f, d:%.1f\n", xy[0].toFloat(), xy[1].toFloat(), xy[2].toFloat()); //printf("coords = x: %.1f, y: %.1f, d:%.1f\n", xy[0].toFloat(), xy[1].toFloat(), xy[2].toFloat());
float x = xy[0].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_x = drawPathEnd.getPathX();
int path_y = drawPathEnd.getPathY(); int path_y = drawPathEnd.getPathY();
drawDesire.draw(s, path_x, path_y - 135); drawDesire.draw(s, path_x, path_y - 135);
drawPlot.draw(s); drawPlot.draw(s);
@ -2751,8 +2751,30 @@ public:
strcpy(bottom, str.toStdString().c_str()); strcpy(bottom, str.toStdString().c_str());
// bottom_left // 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")); 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 // bottom_right
Params params_memory = Params("/dev/shm/params"); Params params_memory = Params("/dev/shm/params");