Controls - Device Management - Disable Uploads - Only Onroad

This commit is contained in:
FrogAi 2024-05-11 16:30:00 -07:00
parent c38b11c85f
commit 032b660fed
2 changed files with 4 additions and 2 deletions

View File

@ -47,7 +47,7 @@ def allow_logging(started, params, CP: car.CarParams) -> bool:
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"))
allow_uploads = not (params.get_bool("DeviceManagement") and params.get_bool("NoUploads") and not params.get_bool("DisableOnroadUploads"))
return allow_uploads
procs = [

View File

@ -248,9 +248,11 @@ def main(exit_event: threading.Event = None) -> None:
backoff = 0.1
while not exit_event.is_set():
sm.update(0)
disable_onroad_uploads = params.get_bool("DeviceManagement") and params.get_bool("NoUploads") and params.get_bool("DisableOnroadUploads")
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 disable_onroad_uploads 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