diff --git a/common/params.cc b/common/params.cc index 35e9ea7..7be23cc 100644 --- a/common/params.cc +++ b/common/params.cc @@ -259,6 +259,7 @@ std::unordered_map keys = { {"ExperimentalModeViaDistance", PERSISTENT}, {"ExperimentalModeViaLKAS", PERSISTENT}, {"ExperimentalModeViaScreen", PERSISTENT}, + {"FireTheBabysitter", PERSISTENT}, {"FrogPilotTogglesUpdated", PERSISTENT}, {"FrogsGoMoo", PERSISTENT}, {"GoatScream", PERSISTENT}, @@ -268,6 +269,9 @@ std::unordered_map keys = { {"LongitudinalTune", PERSISTENT}, {"ManualUpdateInitiated", CLEAR_ON_MANAGER_START}, {"ModelUI", PERSISTENT}, + {"MuteOverheated", PERSISTENT}, + {"NoLogging", PERSISTENT}, + {"NoUploads", PERSISTENT}, {"PathEdgeWidth", PERSISTENT}, {"PathWidth", PERSISTENT}, {"PromptVolume", PERSISTENT}, diff --git a/selfdrive/assets/offroad/icon_wifi_uploading_disabled.svg b/selfdrive/assets/offroad/icon_wifi_uploading_disabled.svg new file mode 100644 index 0000000..1560525 --- /dev/null +++ b/selfdrive/assets/offroad/icon_wifi_uploading_disabled.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/selfdrive/frogpilot/assets/toggle_icons/icon_babysitter.png b/selfdrive/frogpilot/assets/toggle_icons/icon_babysitter.png new file mode 100644 index 0000000..9789aeb Binary files /dev/null and b/selfdrive/frogpilot/assets/toggle_icons/icon_babysitter.png differ diff --git a/selfdrive/frogpilot/ui/control_settings.cc b/selfdrive/frogpilot/ui/control_settings.cc index 6587b37..4489502 100644 --- a/selfdrive/frogpilot/ui/control_settings.cc +++ b/selfdrive/frogpilot/ui/control_settings.cc @@ -19,6 +19,11 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil {"ExperimentalModeViaScreen", "Double Taping the Onroad UI", "Enable/disable 'Experimental Mode' by double taping the onroad UI within a 0.5 second time frame.", ""}, {"ExperimentalModeViaDistance", "Long Pressing the Distance Button", "Enable/disable 'Experimental Mode' by holding down the 'distance' button on your steering wheel for 0.5 seconds.", ""}, + {"FireTheBabysitter", "Fire the Babysitter", "Deactivate some of openpilot's 'Babysitter' protocols for more user autonomy.", "../frogpilot/assets/toggle_icons/icon_babysitter.png"}, + {"MuteOverheated", "Bypass Thermal Safety Limits", "Allow the device to run at any temperature even above comma's recommended thermal limits.", ""}, + {"NoLogging", "Disable Logging", "Turn off all data tracking to enhance privacy or reduce thermal load.\n\nWARNING: This action will prevent drive recording and data cannot be recovered!", ""}, + {"NoUploads", "Disable Uploads", "Turn off all data uploads to comma's servers.\n\nWARNING: This action will prevent your drives from appearing on comma connect which may impact debugging and support!", ""}, + {"LateralTune", "Lateral Tuning", "Modify openpilot's steering behavior.", "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"}, {"LongitudinalTune", "Longitudinal Tuning", "Modify openpilot's acceleration and braking behavior.", "../frogpilot/assets/toggle_icons/icon_longitudinal_tune.png"}, @@ -157,6 +162,16 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil }); toggle = experimentalModeActivationToggle; + } else if (param == "FireTheBabysitter") { + FrogPilotParamManageControl *fireTheBabysitterToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); + QObject::connect(fireTheBabysitterToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { + parentToggleClicked(); + for (auto &[key, toggle] : toggles) { + toggle->setVisible(fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end()); + } + }); + toggle = fireTheBabysitterToggle; + } else if (param == "LateralTune") { FrogPilotParamManageControl *lateralTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); QObject::connect(lateralTuneToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { @@ -230,6 +245,14 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil }); } + QObject::connect(toggles["MuteOverheated"], &ToggleControl::toggleFlipped, [this]() { + if (params.getBool("MuteOverheated")) { + FrogPilotConfirmationDialog::toggleAlert( + "WARNING: This MAY cause premature wear or damage by running the device over comma's recommended temperature limits!", + "I understand the risks.", this); + } + }); + std::set rebootKeys = {"AlwaysOnLateral"}; for (const std::string &key : rebootKeys) { QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this, key]() { diff --git a/selfdrive/frogpilot/ui/control_settings.h b/selfdrive/frogpilot/ui/control_settings.h index 68899b1..300dbeb 100644 --- a/selfdrive/frogpilot/ui/control_settings.h +++ b/selfdrive/frogpilot/ui/control_settings.h @@ -37,7 +37,7 @@ private: std::set conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal"}; std::set experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"}; - std::set fireTheBabysitterKeys = {}; + std::set fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads"}; std::set laneChangeKeys = {}; std::set lateralTuneKeys = {}; std::set longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration"}; diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index f9621f7..29ecd65 100644 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -334,7 +334,7 @@ def manager_cleanup() -> None: def update_frogpilot_params(params, params_memory): - keys = ["DisableOnroadUploads"] + keys = ["DisableOnroadUploads", "FireTheBabysitter", "NoLogging", "NoUploads"] for key in keys: params_memory.put_bool(key, params.get_bool(key)) diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py index 9996349..3eff5bf 100644 --- a/selfdrive/manager/process_config.py +++ b/selfdrive/manager/process_config.py @@ -43,23 +43,28 @@ def only_offroad(started, params, params_memory, CP: car.CarParams) -> bool: # FrogPilot functions def allow_uploads(started, params, params_memory, CP: car.CarParams) -> bool: + allow_uploads = not (params_memory.get_bool("FireTheBabysitter") and params_memory.get_bool("NoUploads")) at_home = not started or not params_memory.get_bool("DisableOnroadUploads") - return at_home + return allow_uploads and at_home + +def allow_logging(started, params, params_memory, CP: car.CarParams) -> bool: + allow_logging = not (params_memory.get_bool("FireTheBabysitter") and params_memory.get_bool("NoLogging")) + return allow_logging and logging(started, params, params_memory, CP) procs = [ DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"), NativeProcess("camerad", "system/camerad", ["./camerad"], driverview), - NativeProcess("logcatd", "system/logcatd", ["./logcatd"], only_onroad), - NativeProcess("proclogd", "system/proclogd", ["./proclogd"], only_onroad), - PythonProcess("logmessaged", "system.logmessaged", always_run), + NativeProcess("logcatd", "system/logcatd", ["./logcatd"], allow_logging), + NativeProcess("proclogd", "system/proclogd", ["./proclogd"], allow_logging), + PythonProcess("logmessaged", "system.logmessaged", allow_logging), PythonProcess("micd", "system.micd", iscar), PythonProcess("timed", "system.timed", always_run, enabled=not PC), PythonProcess("dmonitoringmodeld", "selfdrive.modeld.dmonitoringmodeld", driverview, enabled=(not PC or WEBCAM)), - NativeProcess("encoderd", "system/loggerd", ["./encoderd"], only_onroad), + NativeProcess("encoderd", "system/loggerd", ["./encoderd"], allow_logging), NativeProcess("stream_encoderd", "system/loggerd", ["./encoderd", "--stream"], notcar), - NativeProcess("loggerd", "system/loggerd", ["./loggerd"], logging), + NativeProcess("loggerd", "system/loggerd", ["./loggerd"], allow_logging), NativeProcess("modeld", "selfdrive/modeld", ["./modeld"], only_onroad), NativeProcess("mapsd", "selfdrive/navd", ["./mapsd"], only_onroad), PythonProcess("navmodeld", "selfdrive.modeld.navmodeld", only_onroad), @@ -82,10 +87,10 @@ procs = [ PythonProcess("plannerd", "selfdrive.controls.plannerd", only_onroad), PythonProcess("radard", "selfdrive.controls.radard", only_onroad), PythonProcess("thermald", "selfdrive.thermald.thermald", always_run), - PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC), + PythonProcess("tombstoned", "selfdrive.tombstoned", allow_logging, enabled=not PC), PythonProcess("updated", "selfdrive.updated", only_offroad, enabled=not PC), PythonProcess("uploader", "system.loggerd.uploader", allow_uploads), - PythonProcess("statsd", "selfdrive.statsd", always_run), + PythonProcess("statsd", "selfdrive.statsd", allow_logging), # debug procs NativeProcess("bridge", "cereal/messaging", ["./bridge"], notcar), diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 33ef4e2..93b7a78 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -297,6 +297,9 @@ def thermald_thread(end_event, hw_queue) -> None: elif current_band.max_temp is not None and all_comp_temp > current_band.max_temp: thermal_status = list(THERMAL_BANDS.keys())[band_idx + 1] + if params.get_bool("FireTheBabysitter") and params.get_bool("MuteOverheated"): + thermal_status = ThermalStatus.green + # **** starting logic **** startup_conditions["up_to_date"] = params.get("Offroad_ConnectivityNeeded") is None or params.get_bool("DisableUpdates") or params.get_bool("SnoozeUpdate") diff --git a/selfdrive/ui/qt/widgets/wifi.cc b/selfdrive/ui/qt/widgets/wifi.cc index 9c5289a..95beab4 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("../assets/offroad/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("Training data wont be pulled periodically until you disable the 'Disable Uploading' toggle")); + 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); + auto uploading_disabled = params.getBool("NoUploads"); + stack->setCurrentIndex(uploading_disabled ? 2 : uploading ? 1 : 0); }