From c38b11c85f01e547920206271e4d4dd0705eef77 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Fri, 10 May 2024 11:17:55 -0700 Subject: [PATCH] Controls - Device Management - Disable Uploads Turn off all data uploads to comma's servers. --- .../icon_wifi_uploading_disabled.svg | 6 ++++ selfdrive/manager/process_config.py | 6 +++- selfdrive/ui/qt/offroad/settings.cc | 2 +- selfdrive/ui/qt/widgets/wifi.cc | 31 ++++++++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 selfdrive/frogpilot/assets/other_images/icon_wifi_uploading_disabled.svg diff --git a/selfdrive/frogpilot/assets/other_images/icon_wifi_uploading_disabled.svg b/selfdrive/frogpilot/assets/other_images/icon_wifi_uploading_disabled.svg new file mode 100644 index 0000000..1560525 --- /dev/null +++ b/selfdrive/frogpilot/assets/other_images/icon_wifi_uploading_disabled.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py index ff0fb8c..fdd9900 100644 --- a/selfdrive/manager/process_config.py +++ b/selfdrive/manager/process_config.py @@ -46,6 +46,10 @@ def allow_logging(started, params, CP: car.CarParams) -> bool: allow_logging = not (params.get_bool("DeviceManagement") and params.get_bool("NoLogging")) return allow_logging and logging(started, params, CP) +def allow_uploads(started, params, CP: car.CarParams) -> bool: + allow_uploads = not (params.get_bool("DeviceManagement") and params.get_bool("NoUploads")) + return allow_uploads + procs = [ DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"), @@ -85,7 +89,7 @@ procs = [ PythonProcess("thermald", "selfdrive.thermald.thermald", always_run), PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC), PythonProcess("updated", "selfdrive.updated.updated", always_run, enabled=not PC), - PythonProcess("uploader", "system.loggerd.uploader", always_run), + PythonProcess("uploader", "system.loggerd.uploader", allow_uploads), PythonProcess("statsd", "selfdrive.statsd", allow_logging), # debug procs diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index c8a2dca..745a07e 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -160,7 +160,7 @@ void TogglesPanel::updateToggles() { auto disengage_on_accelerator_toggle = toggles["DisengageOnAccelerator"]; disengage_on_accelerator_toggle->setVisible(!params.getBool("AlwaysOnLateral")); auto driver_camera_toggle = toggles["RecordFront"]; - driver_camera_toggle->setVisible(!(params.getBool("DeviceManagement") && params.getBool("NoLogging"))); + driver_camera_toggle->setVisible(!(params.getBool("DeviceManagement") && params.getBool("NoLogging") && params.getBool("NoUploads"))); auto experimental_mode_toggle = toggles["ExperimentalMode"]; auto op_long_toggle = toggles["ExperimentalLongitudinalEnabled"]; diff --git a/selfdrive/ui/qt/widgets/wifi.cc b/selfdrive/ui/qt/widgets/wifi.cc index 9c5289a..591c1ce 100644 --- a/selfdrive/ui/qt/widgets/wifi.cc +++ b/selfdrive/ui/qt/widgets/wifi.cc @@ -81,6 +81,34 @@ WiFiPromptWidget::WiFiPromptWidget(QWidget *parent) : QFrame(parent) { } stack->addWidget(uploading); + QWidget *notUploading = new QWidget; + QVBoxLayout *not_uploading_layout = new QVBoxLayout(notUploading); + not_uploading_layout->setContentsMargins(64, 56, 64, 56); + not_uploading_layout->setSpacing(36); + { + QHBoxLayout *title_layout = new QHBoxLayout; + { + QLabel *title = new QLabel(tr("Uploading disabled")); + title->setStyleSheet("font-size: 64px; font-weight: 600;"); + title->setWordWrap(true); + title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); + title_layout->addWidget(title); + title_layout->addStretch(); + + QLabel *icon = new QLabel; + QPixmap pixmap("../frogpilot/assets/other_images/icon_wifi_uploading_disabled.svg"); + icon->setPixmap(pixmap.scaledToWidth(120, Qt::SmoothTransformation)); + title_layout->addWidget(icon); + } + not_uploading_layout->addLayout(title_layout); + + QLabel *desc = new QLabel(tr("Toggle off the 'Disable Uploading' toggle to enable uploads.")); + desc->setStyleSheet("font-size: 48px; font-weight: 400;"); + desc->setWordWrap(true); + not_uploading_layout->addWidget(desc); + } + stack->addWidget(notUploading); + setStyleSheet(R"( WiFiPromptWidget { background-color: #333333; @@ -99,5 +127,6 @@ void WiFiPromptWidget::updateState(const UIState &s) { auto network_type = sm["deviceState"].getDeviceState().getNetworkType(); auto uploading = network_type == cereal::DeviceState::NetworkType::WIFI || network_type == cereal::DeviceState::NetworkType::ETHERNET; - stack->setCurrentIndex(uploading ? 1 : 0); + bool uploading_disabled = params.getBool("DeviceManagement") && params.getBool("NoUploads"); + stack->setCurrentIndex(uploading_disabled ? 2 : uploading ? 1 : 0); }