將數值分開儲存

This commit is contained in:
Rick Lan
2019-07-12 09:16:49 +10:00
parent ff3145215e
commit 2b44c2fe3d
2 changed files with 10 additions and 4 deletions

View File

@@ -83,8 +83,10 @@ def fingerprint(logcan, sendcan):
frame = 0
if params.get("DragonUseCachedCar") == "1" and params.get("DragonCachedCar") is not None:
candidate_cars, finger, vin = pickle.loads(params.get("DragonCachedCar"))
if params.get("DragonUseCachedCar") == "1" and params.get("DragonCachedFP") != "" and params.get("DragonCachedModel") != "":
candidate_cars = [params.get("DragonCachedModel")]
finger = params.get("DragonCachedFP")
vin = params.get("DragonCachedVIN")
else:
while True:
a = messaging.recv_one(logcan)
@@ -139,7 +141,9 @@ def fingerprint(logcan, sendcan):
if vin_step == len(vin_cnts) and vin_cnt == vin_cnts[-1]:
vin = "".join(vin_dat[3:])
params.put("DragonCachedCar", pickle.dumps([candidate_cars, finger, vin]))
params.put("DragonCachedModel", pickle.dumps(candidate_cars))
params.put("DragonCachedFP", pickle.dumps(finger))
params.put("DragonCachedVIN", pickle.dumps(vin))
cloudlog.warning("fingerprinted %s", candidate_cars[0])
cloudlog.warning("VIN %s", vin)

View File

@@ -13,7 +13,9 @@ default_conf = {
'DragonDisableLogger': '0',
'DragonNoctuaMode': '0',
'DragonUseCachedCar': '1',
'DragonCachedCar': '',
'DragonCachedModel': '', # for cache car
'DragonCachedFP': '', # for cache car
'DragonCachedVIN': '', # for cache car
}
def dragonpilot_set_params(params):