Disable onroad uploads
Added toggle to the "Networking" tab to disable uploads to connect.comma.ai while driving and without a WiFi connection to prevent large amounts of data usage.
This commit is contained in:
@@ -244,6 +244,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"CustomSounds", PERSISTENT},
|
{"CustomSounds", PERSISTENT},
|
||||||
{"CustomTheme", PERSISTENT},
|
{"CustomTheme", PERSISTENT},
|
||||||
{"DeviceShutdown", PERSISTENT},
|
{"DeviceShutdown", PERSISTENT},
|
||||||
|
{"DisableOnroadUploads", PERSISTENT},
|
||||||
{"FrogPilotTogglesUpdated", PERSISTENT},
|
{"FrogPilotTogglesUpdated", PERSISTENT},
|
||||||
{"GasRegenCmd", PERSISTENT},
|
{"GasRegenCmd", PERSISTENT},
|
||||||
{"GoatScream", PERSISTENT},
|
{"GoatScream", PERSISTENT},
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from cereal import car
|
from cereal import car, log
|
||||||
from openpilot.common.params import Params
|
from openpilot.common.params import Params
|
||||||
from openpilot.system.hardware import PC, TICI
|
from openpilot.system.hardware import HARDWARE, PC, TICI
|
||||||
from openpilot.selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess
|
from openpilot.selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess
|
||||||
|
|
||||||
|
WIFI = log.DeviceState.NetworkType.wifi
|
||||||
|
|
||||||
WEBCAM = os.getenv("USE_WEBCAM") is not None
|
WEBCAM = os.getenv("USE_WEBCAM") is not None
|
||||||
|
|
||||||
def driverview(started: bool, params: Params, CP: car.CarParams) -> bool:
|
def driverview(started: bool, params: Params, CP: car.CarParams) -> bool:
|
||||||
@@ -42,6 +44,9 @@ def only_offroad(started, params, CP: car.CarParams) -> bool:
|
|||||||
return not started
|
return not started
|
||||||
|
|
||||||
# FrogPilot functions
|
# FrogPilot functions
|
||||||
|
def allow_uploads(started, params, CP: car.CarParams) -> bool:
|
||||||
|
wifi_connected = HARDWARE.get_network_type() == WIFI and not started
|
||||||
|
return wifi_connected if params.get_bool("DisableOnroadUploads") else True
|
||||||
|
|
||||||
procs = [
|
procs = [
|
||||||
DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"),
|
DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"),
|
||||||
@@ -81,7 +86,7 @@ procs = [
|
|||||||
PythonProcess("thermald", "selfdrive.thermald.thermald", always_run),
|
PythonProcess("thermald", "selfdrive.thermald.thermald", always_run),
|
||||||
PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC),
|
PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC),
|
||||||
PythonProcess("updated", "selfdrive.updated", only_offroad, enabled=not PC),
|
PythonProcess("updated", "selfdrive.updated", only_offroad, enabled=not PC),
|
||||||
PythonProcess("uploader", "system.loggerd.uploader", always_run),
|
PythonProcess("uploader", "system.loggerd.uploader", allow_uploads),
|
||||||
PythonProcess("statsd", "selfdrive.statsd", always_run),
|
PythonProcess("statsd", "selfdrive.statsd", always_run),
|
||||||
|
|
||||||
# debug procs
|
# debug procs
|
||||||
|
|||||||
@@ -201,6 +201,14 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
|
|||||||
});
|
});
|
||||||
list->addItem(hiddenNetworkButton);
|
list->addItem(hiddenNetworkButton);
|
||||||
|
|
||||||
|
// Disable onroad uploads toggle
|
||||||
|
const bool disableOnroadUploads = params.getBool("DisableOnroadUploads");
|
||||||
|
disableOnroadUploadsToggle = new ToggleControl(tr("Disable Onroad Uploads"), tr("Prevent large data uploads when onroad."), "", disableOnroadUploads);
|
||||||
|
QObject::connect(disableOnroadUploadsToggle, &ToggleControl::toggleFlipped, [=](bool state) {
|
||||||
|
params.putBool("DisableOnroadUploads", state);
|
||||||
|
});
|
||||||
|
list->addItem(disableOnroadUploadsToggle);
|
||||||
|
|
||||||
// Set initial config
|
// Set initial config
|
||||||
wifi->updateGsmSettings(roamingEnabled, QString::fromStdString(params.get("GsmApn")), metered);
|
wifi->updateGsmSettings(roamingEnabled, QString::fromStdString(params.get("GsmApn")), metered);
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ private:
|
|||||||
WifiManager* wifi = nullptr;
|
WifiManager* wifi = nullptr;
|
||||||
Params params;
|
Params params;
|
||||||
|
|
||||||
|
// FrogPilot variables
|
||||||
|
ToggleControl *disableOnroadUploadsToggle;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void backPress();
|
void backPress();
|
||||||
void requestWifiScreen();
|
void requestWifiScreen();
|
||||||
|
|||||||
Reference in New Issue
Block a user