diff --git a/selfdrive/frogpilot/assets/wheel_images/frog.png b/selfdrive/frogpilot/assets/wheel_images/frog.png new file mode 100644 index 000000000..712255984 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 000000000..4a0371ccf 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 000000000..aa9779fc7 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 000000000..b624d00b9 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 000000000..4c2e1e046 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 000000000..bc392ed13 Binary files /dev/null and b/selfdrive/frogpilot/assets/wheel_images/toyota.png differ diff --git a/selfdrive/ui/qt/onroad/buttons.cc b/selfdrive/ui/qt/onroad/buttons.cc index 148eaee4b..719c6be0e 100644 --- a/selfdrive/ui/qt/onroad/buttons.cc +++ b/selfdrive/ui/qt/onroad/buttons.cc @@ -22,6 +22,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() { @@ -49,13 +59,31 @@ void ExperimentalButton::updateState(const UIState &s) { // FrogPilot variables const UIScene &scene = s.scene; + alwaysOnLateralActive = scene.always_on_lateral_active; conditionalExperimental = scene.conditional_experimental; conditionalStatus = scene.conditional_status; + navigateOnOpenpilot = scene.navigate_on_openpilot; + trafficModeActive = scene.traffic_mode_active; + 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 ? + (alwaysOnLateralActive ? bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE] : + (conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5 ? bg_colors[STATUS_CONDITIONAL_OVERRIDDEN] : + (experimental_mode ? bg_colors[STATUS_EXPERIMENTAL_MODE_ACTIVE] : + (trafficModeActive ? bg_colors[STATUS_TRAFFIC_MODE_ACTIVE] : + (navigateOnOpenpilot ? 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/buttons.h b/selfdrive/ui/qt/onroad/buttons.h index 1b71fe492..ab183ff02 100644 --- a/selfdrive/ui/qt/onroad/buttons.h +++ b/selfdrive/ui/qt/onroad/buttons.h @@ -25,9 +25,15 @@ private: bool engageable; // FrogPilot variables + bool alwaysOnLateralActive; bool conditionalExperimental; + bool navigateOnOpenpilot; + bool trafficModeActive; int conditionalStatus; + int wheelIcon; + + QMap wheelImages; Params paramsMemory{"/dev/shm/params"}; }; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 1590b3a0a..b57195807 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -321,6 +321,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { 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 9c40991c4..5eba054d3 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -182,6 +182,7 @@ typedef struct UIScene { int conditional_speed_lead; int conditional_status; int tethering_config; + int wheel_icon; QPolygonF track_adjacent_vertices[6];