diff --git a/common/params.cc b/common/params.cc index 59f6ca1816..1c791fdf1a 100644 --- a/common/params.cc +++ b/common/params.cc @@ -224,7 +224,6 @@ std::unordered_map keys = { {"CarModelText", PERSISTENT}, {"ChevronInfo", PERSISTENT}, {"CustomBootScreen", PERSISTENT}, - {"CustomMapbox", PERSISTENT}, {"CustomMapboxTokenPk", PERSISTENT}, {"CustomMapboxTokenSk", PERSISTENT}, {"CustomOffsets", PERSISTENT}, diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index fb9f0a3ee0..0d6306745a 100755 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -48,8 +48,8 @@ class RouteEngine: self.reroute_counter = 0 - if self.params.get_bool("CustomMapbox") or "MAPBOX_TOKEN" in os.environ: - self.mapbox_token = self.params.get("CustomMapboxTokenSk") if self.params.get_bool("CustomMapbox") else os.environ["MAPBOX_TOKEN"] + if self.params.get("CustomMapboxTokenSk") is not None or "MAPBOX_TOKEN" in os.environ: + self.mapbox_token = self.params.get("CustomMapboxTokenSk") if self.params.get("CustomMapboxTokenSk") is not None else os.environ["MAPBOX_TOKEN"] self.mapbox_host = "https://api.mapbox.com" else: try: diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 26fde649e7..fcb7626430 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -172,15 +172,15 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) { #else left_widget->addWidget(new DriveStats); #endif - custom_mapbox = params.getBool("CustomMapbox") && QString::fromStdString(params.get("CustomMapboxTokenSk")) != ""; + custom_mapbox = QString::fromStdString(params.get("CustomMapboxTokenSk")) != ""; if (!custom_mapbox) { left_widget->addWidget(new PrimeAdWidget); } left_widget->setStyleSheet("border-radius: 10px;"); - left_widget->setCurrentIndex(!custom_mapbox ? uiState()->hasPrime() ? 0 : 1 : 0); - connect(uiState(), &UIState::primeChanged, [=](int prime) { - left_widget->setCurrentIndex(!custom_mapbox ? prime ? 0 : 1 : 0); + left_widget->setCurrentIndex((uiState()->hasPrime() || custom_mapbox) ? 0 : 1); + connect(uiState(), &UIState::primeChanged, [=](bool prime) { + left_widget->setCurrentIndex((prime || custom_mapbox) ? 0 : 1); }); home_layout->addWidget(left_widget, 1); diff --git a/selfdrive/ui/qt/maps/map_helpers.h b/selfdrive/ui/qt/maps/map_helpers.h index d0dd65e7a6..b72c301f4f 100644 --- a/selfdrive/ui/qt/maps/map_helpers.h +++ b/selfdrive/ui/qt/maps/map_helpers.h @@ -13,7 +13,7 @@ #include "cereal/messaging/messaging.h" #include "common/params.h" -const QString MAPBOX_TOKEN = Params().getBool("CustomMapbox") ? QString::fromStdString(Params().get("CustomMapboxTokenSk")) : util::getenv("MAPBOX_TOKEN").c_str(); +const QString MAPBOX_TOKEN = QString::fromStdString(Params().get("CustomMapboxTokenSk")) != "" ? QString::fromStdString(Params().get("CustomMapboxTokenSk")) : util::getenv("MAPBOX_TOKEN").c_str(); const QString MAPS_HOST = util::getenv("MAPS_HOST", MAPBOX_TOKEN.isEmpty() ? "https://maps.comma.ai" : "https://api.mapbox.com").c_str(); const QString MAPS_CACHE_PATH = "/data/mbgl-cache-navd.db"; diff --git a/selfdrive/ui/qt/offroad/sunnypilot_settings.cc b/selfdrive/ui/qt/offroad/sunnypilot_settings.cc index 6ce6c7fdf6..7b023c588d 100644 --- a/selfdrive/ui/qt/offroad/sunnypilot_settings.cc +++ b/selfdrive/ui/qt/offroad/sunnypilot_settings.cc @@ -635,19 +635,6 @@ SPVisualsPanel::SPVisualsPanel(QWidget *parent) : ListWidget(parent) { tr("OSM: Show UI elements that aid debugging."), "../assets/offroad/icon_calibration.png", }, - { - "CustomMapbox", - tr("Enable Mapbox Navigation*"), - QString("%1
" - "%2
" - "%3
" - "

%4

") - .arg(tr("Enable built-in navigation on sunnypilot, powered by Mapbox.")) - .arg(tr("Access via the web interface: \"http://:8082\"")) - .arg(tr("If you do not have comma Prime, you will need to provide your own Mapbox token at https://mapbox.com/. Reach out to sunnyhaibin#0865 on Discord for more information.")) - .arg(tr("Huge thanks to the dragonpilot team for making this possible!")), - "../assets/img_map.png", - }, { "TrueVEgoUi", tr("Speedometer: Display True Speed"), @@ -701,14 +688,6 @@ SPVisualsPanel::SPVisualsPanel(QWidget *parent) : ListWidget(parent) { // trigger offroadTransition when going onroad/offroad connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { - toggles["CustomMapbox"]->setEnabled(offroad); - }); - - // trigger hardwrae reboot if user confirms the selection - connect(toggles["CustomMapbox"], &ToggleControl::toggleFlipped, [=](bool state) { - if (ConfirmationDialog::confirm(tr("\"Enable Mapbox Navigation\"\nYou must restart your car or your device to apply these changes.\nReboot now?"), "Reboot", parent)) { - Hardware::reboot(); - } }); } diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 82c0ed4f0b..ceb8057bbd 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -235,8 +235,7 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) { void OnroadWindow::offroadTransition(bool offroad) { if (!offroad) { #ifdef ENABLE_MAPS - bool custom_mapbox = params.getBool("CustomMapbox") && QString::fromStdString(params.get("CustomMapboxTokenSk")) != ""; - if (map == nullptr && (uiState()->hasPrime() || !MAPBOX_TOKEN.isEmpty() || custom_mapbox)) { + if (map == nullptr && (uiState()->hasPrime() || !MAPBOX_TOKEN.isEmpty())) { auto m = new MapPanel(get_mapbox_settings()); map = m;