diff --git a/selfdrive/ui/qt/maps/map.cc b/selfdrive/ui/qt/maps/map.cc index 9e54daf..d2d7cf0 100644 --- a/selfdrive/ui/qt/maps/map.cc +++ b/selfdrive/ui/qt/maps/map.cc @@ -293,6 +293,30 @@ void MapWindow::updateState(const UIState &s) { route_rcv_frame = sm.rcv_frame("navRoute"); updateDestinationMarker(); } + + // Map Styling - Credit goes to OPKR! + int map_style = uiState()->scene.map_style; + + if (map_style != previous_map_style) { + std::unordered_map styleUrls = { + {0, "mapbox://styles/commaai/clkqztk0f00ou01qyhsa5bzpj"}, // Stock openpilot + {1, "mapbox://styles/mapbox/streets-v11"}, // Mapbox Streets + {2, "mapbox://styles/mapbox/outdoors-v11"}, // Mapbox Outdoors + {3, "mapbox://styles/mapbox/light-v10"}, // Mapbox Light + {4, "mapbox://styles/mapbox/dark-v10"}, // Mapbox Dark + {5, "mapbox://styles/mapbox/satellite-v9"}, // Mapbox Satellite + {6, "mapbox://styles/mapbox/satellite-streets-v11"}, // Mapbox Satellite Streets + {7, "mapbox://styles/mapbox/navigation-day-v1"}, // Mapbox Navigation Day + {8, "mapbox://styles/mapbox/navigation-night-v1"}, // Mapbox Navigation Night + {9, "mapbox://styles/mapbox/traffic-night-v2"}, // Mapbox Traffic Night + {10, "mapbox://styles/mike854/clt0hm8mw01ok01p4blkr27jp"}, // mike854's (Satellite hybrid) + }; + + std::unordered_map::iterator it = styleUrls.find(map_style); + m_map->setStyleUrl(QString::fromStdString(it->second)); + } + + previous_map_style = map_style; } void MapWindow::setError(const QString &err_str) { diff --git a/selfdrive/ui/qt/maps/map.h b/selfdrive/ui/qt/maps/map.h index 5849b64..fe10a20 100644 --- a/selfdrive/ui/qt/maps/map.h +++ b/selfdrive/ui/qt/maps/map.h @@ -81,6 +81,10 @@ private: // FrogPilot variables Params params; + int previous_map_style; + + uint64_t model_rcv_frame = 0; + private slots: void updateState(const UIState &s); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 317173f..87f3617 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -405,6 +405,7 @@ void ui_update_frogpilot_params(UIState *s) { scene.driver_camera = quality_of_life_visuals && params.getBool("DriverCamera"); scene.hide_speed = quality_of_life_visuals && params.getBool("HideSpeed"); scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI"); + scene.map_style = quality_of_life_visuals ? params.getInt("MapStyle") : 0; scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 94a8629..0529f1d 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -296,6 +296,7 @@ typedef struct UIScene { int custom_signals; int desired_follow; int driver_camera_timer; + int map_style; int obstacle_distance; int obstacle_distance_stock; int steering_angle_deg;