Skip to content

Commit 5f64f1c

Browse files
robbederkspd0wm
andauthored
Param to allow upload over cellular (commaai#23811)
* param to allow upload over cellular * brackets to be consistent * move outside loop * fix tests Co-authored-by: Willem Melching <willem.melching@gmail.com>
1 parent efc9084 commit 5f64f1c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

selfdrive/athena/athenad.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ def upload_handler(end_event: threading.Event) -> None:
163163
sm = messaging.SubMaster(['deviceState'])
164164
tid = threading.get_ident()
165165

166+
cellular_unmetered = Params().get_bool("CellularUnmetered")
167+
166168
while not end_event.is_set():
167169
cur_upload_items[tid] = None
168170

@@ -182,7 +184,7 @@ def upload_handler(end_event: threading.Event) -> None:
182184
# Check if uploading over cell is allowed
183185
sm.update(0)
184186
cell = sm['deviceState'].networkType not in [NetworkType.wifi, NetworkType.ethernet]
185-
if cell and (not cur_upload_items[tid].allow_cellular):
187+
if cell and (not cur_upload_items[tid].allow_cellular) and (not cellular_unmetered):
186188
retry_upload(tid, end_event, False)
187189
continue
188190

selfdrive/athena/tests/helpers.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,18 @@ class MockParams():
5353
default_params = {
5454
"DongleId": b"0000000000000000",
5555
"GithubSshKeys": b"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC307aE+nuHzTAgaJhzSf5v7ZZQW9gaperjhCmyPyl4PzY7T1mDGenTlVTN7yoVFZ9UfO9oMQqo0n1OwDIiqbIFxqnhrHU0cYfj88rI85m5BEKlNu5RdaVTj1tcbaPpQc5kZEolaI1nDDjzV0lwS7jo5VYDHseiJHlik3HH1SgtdtsuamGR2T80q1SyW+5rHoMOJG73IH2553NnWuikKiuikGHUYBd00K1ilVAK2xSiMWJp55tQfZ0ecr9QjEsJ+J/efL4HqGNXhffxvypCXvbUYAFSddOwXUPo5BTKevpxMtH+2YrkpSjocWA04VnTYFiPG6U4ItKmbLOTFZtPzoez private", # noqa: E501
56-
"AthenadUploadQueue": '[]'
56+
"AthenadUploadQueue": '[]',
57+
"CellularUnmetered": False,
5758
}
5859
params = default_params.copy()
5960

6061
@staticmethod
6162
def restore_defaults():
6263
MockParams.params = MockParams.default_params.copy()
6364

65+
def get_bool(self, k):
66+
return bool(MockParams.params.get(k))
67+
6468
def get(self, k, encoding=None):
6569
ret = MockParams.params.get(k)
6670
if ret is not None and encoding is not None:

selfdrive/common/params.cc

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ std::unordered_map<std::string, uint32_t> keys = {
9191
{"CarParams", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
9292
{"CarParamsCache", CLEAR_ON_MANAGER_START},
9393
{"CarVin", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
94+
{"CellularUnmetered", PERSISTENT},
9495
{"CompletedTrainingVersion", PERSISTENT},
9596
{"ControlsReady", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
9697
{"CurrentRoute", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},

0 commit comments

Comments
 (0)