diff --git a/selfdrive/frogpilot/assets/wheel_images/frog.png b/selfdrive/frogpilot/assets/wheel_images/frog.png new file mode 100644 index 0000000..f0aca65 Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/frog.png differ diff --git a/selfdrive/frogpilot/assets/wheel_images/hyundai.png b/selfdrive/frogpilot/assets/wheel_images/hyundai.png new file mode 100644 index 0000000..60ca0c8 Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/hyundai.png differ diff --git a/selfdrive/frogpilot/assets/wheel_images/lexus.png b/selfdrive/frogpilot/assets/wheel_images/lexus.png new file mode 100644 index 0000000..1be4431 Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/lexus.png differ diff --git a/selfdrive/frogpilot/assets/wheel_images/rocket.png b/selfdrive/frogpilot/assets/wheel_images/rocket.png new file mode 100644 index 0000000..abe753a Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/rocket.png differ diff --git a/selfdrive/frogpilot/assets/wheel_images/stalin.png b/selfdrive/frogpilot/assets/wheel_images/stalin.png new file mode 100644 index 0000000..f1feebb Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/stalin.png differ diff --git a/selfdrive/frogpilot/assets/wheel_images/toyota.png b/selfdrive/frogpilot/assets/wheel_images/toyota.png new file mode 100644 index 0000000..0e8cf4c Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/toyota.png differ diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index f2e14ed..245a460 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -283,6 +283,16 @@ ExperimentalButton::ExperimentalButton(QWidget *parent) : experimental_mode(fals engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size}); experimental_img = loadPixmap("../assets/img_experimental.svg", {img_size, img_size}); QObject::connect(this, &QPushButton::clicked, this, &ExperimentalButton::changeMode); + + wheelImages = { + {0, loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size})}, + {1, loadPixmap("../frogpilot/assets/wheel_images/lexus.png", {img_size, img_size})}, + {2, loadPixmap("../frogpilot/assets/wheel_images/toyota.png", {img_size, img_size})}, + {3, loadPixmap("../frogpilot/assets/wheel_images/frog.png", {img_size, img_size})}, + {4, loadPixmap("../frogpilot/assets/wheel_images/rocket.png", {img_size, img_size})}, + {5, loadPixmap("../frogpilot/assets/wheel_images/hyundai.png", {img_size, img_size})}, + {6, loadPixmap("../frogpilot/assets/wheel_images/stalin.png", {img_size, img_size})}, + }; } void ExperimentalButton::changeMode() { @@ -306,11 +316,28 @@ void ExperimentalButton::updateState(const UIState &s) { experimental_mode = cs.getExperimentalMode(); update(); } + + // FrogPilot variables + wheelIcon = scene.wheel_icon; } void ExperimentalButton::paintEvent(QPaintEvent *event) { + if (wheelIcon < 0) { + return; + } + QPainter p(this); - QPixmap img = experimental_mode ? experimental_img : engage_img; + engage_img = wheelImages[wheelIcon]; + QPixmap img = wheelIcon != 0 ? engage_img : (experimental_mode ? experimental_img : engage_img); + + QColor background_color = wheelIcon != 0 && !isDown() && engageable ? + (scene.always_on_lateral_active ? bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE] : + (scene.conditional_status == 1 || scene.conditional_status == 3 || scene.conditional_status == 5 ? bg_colors[STATUS_CONDITIONAL_OVERRIDDEN] : + (experimental_mode ? bg_colors[STATUS_EXPERIMENTAL_MODE_ACTIVE] : + (scene.traffic_mode_active ? bg_colors[STATUS_TRAFFIC_MODE_ACTIVE] : + (scene.navigate_on_openpilot ? bg_colors[STATUS_NAVIGATION_ACTIVE] : QColor(0, 0, 0, 166)))))) : + QColor(0, 0, 0, 166); + drawIcon(p, QPoint(btn_size / 2, btn_size / 2), img, QColor(0, 0, 0, 166), (isDown() || !engageable) ? 0.6 : 1.0); } diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index 0ab92ae..3ed13ea 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -104,6 +104,10 @@ private: // FrogPilot variables Params paramsMemory{"/dev/shm/params"}; UIScene &scene; + + QMap wheelImages; + + int wheelIcon; }; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index e3098c6..ffdfb6b 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -310,6 +310,7 @@ void ui_update_frogpilot_params(UIState *s) { scene.dynamic_pedals_on_ui = scene.pedals_on_ui && params.getBool("DynamicPedalsOnUI"); scene.static_pedals_on_ui = scene.pedals_on_ui && params.getBool("StaticPedalsOnUI"); scene.road_name_ui = custom_onroad_ui && params.getBool("RoadNameUI"); + scene.wheel_icon = custom_onroad_ui ? params.getInt("WheelIcon") : 0; 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 f5080fd..665f382 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -242,6 +242,7 @@ typedef struct UIScene { int conditional_speed; int conditional_speed_lead; int conditional_status; + int wheel_icon; QPolygonF track_adjacent_vertices[6];