Controls - Device Management - Disable Uploads - Only Onroad
This commit is contained in:
parent
c38b11c85f
commit
032b660fed
@ -47,7 +47,7 @@ def allow_logging(started, params, CP: car.CarParams) -> bool:
|
|||||||
return allow_logging and logging(started, params, CP)
|
return allow_logging and logging(started, params, CP)
|
||||||
|
|
||||||
def allow_uploads(started, params, CP: car.CarParams) -> bool:
|
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
|
return allow_uploads
|
||||||
|
|
||||||
procs = [
|
procs = [
|
||||||
|
@ -248,9 +248,11 @@ def main(exit_event: threading.Event = None) -> None:
|
|||||||
backoff = 0.1
|
backoff = 0.1
|
||||||
while not exit_event.is_set():
|
while not exit_event.is_set():
|
||||||
sm.update(0)
|
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")
|
offroad = params.get_bool("IsOffroad")
|
||||||
network_type = sm['deviceState'].networkType if not force_wifi else NetworkType.wifi
|
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:
|
if allow_sleep:
|
||||||
time.sleep(60 if offroad else 5)
|
time.sleep(60 if offroad else 5)
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user