Disable uploading while onroad

Added toggle to disable uploading to connect.comma.ai while driving and without a WiFi connection.
This commit is contained in:
FrogAi
2024-04-01 10:29:34 -07:00
parent 25a82f57ea
commit 071fd84734
4 changed files with 5 additions and 2 deletions
+1
View File
@@ -249,6 +249,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"DecelerationProfile", PERSISTENT},
{"DeviceManagement", PERSISTENT},
{"DeviceShutdown", PERSISTENT},
{"DisableOnroadUploads", PERSISTENT},
{"DisableOpenpilotLongitudinal", PERSISTENT},
{"DisengageVolume", PERSISTENT},
{"DynamicPathWidth", PERSISTENT},
@@ -36,6 +36,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
{"AggressiveAcceleration", tr("Increase Acceleration Behind Faster Lead"), tr("Increase aggressiveness when following a faster lead."), ""},
{"QOLControls", tr("Quality of Life"), tr("Miscellaneous quality of life changes to improve your overall openpilot experience."), "../frogpilot/assets/toggle_icons/quality_of_life.png"},
{"DisableOnroadUploads", tr("Disable Onroad Uploads"), tr("Prevent uploads to comma connect unless you're offroad and connected to Wi-Fi."), ""},
};
for (const auto &[param, title, desc, icon] : controlToggles) {
@@ -39,7 +39,7 @@ private:
std::set<QString> lateralTuneKeys = {};
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "AggressiveAcceleration", "DecelerationProfile"};
std::set<QString> mtscKeys = {};
std::set<QString> qolKeys = {};
std::set<QString> qolKeys = {"DisableOnroadUploads"};
std::set<QString> speedLimitControllerKeys = {};
std::set<QString> speedLimitControllerControlsKeys = {};
std::set<QString> speedLimitControllerQOLKeys = {};
+2 -1
View File
@@ -250,7 +250,8 @@ def main(exit_event: threading.Event = None) -> None:
sm.update(0)
offroad = params.get_bool("IsOffroad")
network_type = sm['deviceState'].networkType if not force_wifi else NetworkType.wifi
if network_type == NetworkType.none:
at_home = not params.get_bool("DisableOnroadUploads") or offroad and network_type in (NetworkType.ethernet, NetworkType.wifi)
if network_type == NetworkType.none or not at_home:
if allow_sleep:
time.sleep(60 if offroad else 5)
continue