use put_nonblocking instead of params.put

This commit is contained in:
dragonpilot
2019-09-11 11:46:31 +10:00
parent a5518a2330
commit 0d8dbd73a6
3 changed files with 14 additions and 14 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
import os
import zmq
from cereal import car
from common.params import Params
from common.params import Params, put_nonblocking
from common.vin import get_vin, VIN_UNKNOWN
from common.basedir import BASEDIR
from common.fingerprints import eliminate_incompatible_cars, all_known_cars
@@ -138,9 +138,9 @@ def fingerprint(logcan, sendcan, is_panda_black):
frame += 1
if succeeded:
params.put("DragonCachedModel", pickle.dumps(car_fingerprint))
params.put("DragonCachedFP", pickle.dumps(finger))
params.put("DragonCachedVIN", pickle.dumps(vin))
put_nonblocking("DragonCachedModel", pickle.dumps(car_fingerprint))
put_nonblocking("DragonCachedFP", pickle.dumps(finger))
put_nonblocking("DragonCachedVIN", pickle.dumps(vin))
cloudlog.warning("fingerprinted %s", car_fingerprint)
return car_fingerprint, finger, vin
+7 -7
View File
@@ -7,7 +7,7 @@ import subprocess
import cereal
ThermalStatus = cereal.log.ThermalData.ThermalStatus
from selfdrive.swaglog import cloudlog
from common.params import Params
from common.params import Params, put_nonblocking
params = Params()
# v1.16.2
@@ -42,9 +42,9 @@ def main(gctx=None):
stop_delay = None
high_accuracy_mode_enabled = False
params.put('DragonRunTomTom', '0')
params.put('DragonRunAutonavi', '0')
params.put('DragonRunMixplorer', '0')
put_nonblocking('DragonRunTomTom', '0')
put_nonblocking('DragonRunAutonavi', '0')
put_nonblocking('DragonRunMixplorer', '0')
# we want to disable all app when boot
system("pm disable %s ; pm disable %s ; pm disable %s" % (tomtom, autonavi, mixplorer))
@@ -65,21 +65,21 @@ def main(gctx=None):
status = params.get('DragonRunTomTom')
if not status == "0":
tomtom_is_running = execApp(status, tomtom, tomtom_main)
params.put('DragonRunTomTom', '0')
put_nonblocking('DragonRunTomTom', '0')
manual_tomtom = status != "0"
if dragon_enable_autonavi:
status = params.get('DragonRunAutonavi')
if not status == "0":
autonavi_is_running = execApp(status, autonavi, autonavi_main)
params.put('DragonRunAutonavi', '0')
put_nonblocking('DragonRunAutonavi', '0')
manual_autonavi = status != "0"
if dragon_enable_mixplorer:
status = params.get('DragonRunMixplorer')
if not status == "0":
mixplorer_is_running = execApp(status, mixplorer, mixplorer_main)
params.put('DragonRunMixplorer', '0')
put_nonblocking('DragonRunMixplorer', '0')
# if manual control is set, we do not allow any of the auto actions
auto_tomtom = not manual_tomtom and dragon_enable_tomtom and dragon_boot_tomtom
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
from common.params import Params
from common.params import Params, put_nonblocking
default_conf = {
'DragonEnableDashcam': '1',
@@ -68,13 +68,13 @@ def dragonpilot_set_params(params):
# invert the value if true
if old in deprecated_conf_invert and deprecated_conf_invert[old] is True:
new_val = "1" if old_val == "0" else "0"
params.put(new, new_val)
put_nonblocking(new, new_val)
params.delete(old)
# set params
for key, val in default_conf.items():
if params.get(key) is None and key not in deprecated_conf:
params.put(key, str(val))
put_nonblocking(key, str(val))
if __name__ == "__main__":
params = Params()