Disable raw upload while onroad (#1894)

* disable raw upload while onroad

* fix tests
pull/1865/head
Adeeb Shihadeh 5 years ago committed by GitHub
parent 75565b0635
commit c8f880665a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      selfdrive/loggerd/tests/loggerd_tests_common.py
  2. 4
      selfdrive/loggerd/uploader.py

@ -57,6 +57,7 @@ class MockParams():
self.params = { self.params = {
"DongleId": b"0000000000000000", "DongleId": b"0000000000000000",
"IsUploadRawEnabled": b"1", "IsUploadRawEnabled": b"1",
"IsOffroad": b"1",
} }
def get(self, k): def get(self, k):

@ -247,7 +247,8 @@ def uploader_fn(exit_event):
backoff = 0.1 backoff = 0.1
while True: while True:
allow_raw_upload = (params.get("IsUploadRawEnabled") != b"0") offroad = params.get("IsOffroad") == b'1'
allow_raw_upload = (params.get("IsUploadRawEnabled") != b"0") and offroad
on_hotspot = is_on_hotspot() on_hotspot = is_on_hotspot()
on_wifi = is_on_wifi() on_wifi = is_on_wifi()
should_upload = on_wifi and not on_hotspot should_upload = on_wifi and not on_hotspot
@ -257,7 +258,6 @@ def uploader_fn(exit_event):
d = uploader.next_file_to_upload(with_raw=allow_raw_upload and should_upload) d = uploader.next_file_to_upload(with_raw=allow_raw_upload and should_upload)
if d is None: # Nothing to upload if d is None: # Nothing to upload
offroad = params.get("IsOffroad") == b'1'
time.sleep(60 if offroad else 5) time.sleep(60 if offroad else 5)
continue continue

Loading…
Cancel
Save