Vehicles - Force Fingerprint

Added function to automatically detect the vehicle's fingerprint if it exists, or an option to force the vehicle's fingerprint if it doesn't.
This commit is contained in:
FrogAi
2024-06-08 05:33:19 -07:00
parent 579165a7e3
commit 76c0f84d02
+12 -3
View File
@@ -192,11 +192,20 @@ def get_car_interface(CP):
def get_car(logcan, sendcan, disable_openpilot_long, experimental_long_allowed, params, num_pandas=1):
car_model = params.get("CarModel", encoding='utf-8')
force_fingerprint = params.get_bool("ForceFingerprint")
candidate, fingerprints, vin, car_fw, source, exact_match = fingerprint(logcan, sendcan, num_pandas)
if candidate is None:
cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True)
candidate = "MOCK"
if candidate is None or force_fingerprint:
if car_model is not None:
candidate = car_model
else:
cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True)
candidate = "MOCK"
else:
params.put_nonblocking("CarMake", candidate.split('_')[0].title())
params.put_nonblocking("CarModel", candidate)
if get_build_metadata().channel == "FrogPilot-Development" and params.get("DongleId", encoding='utf-8') != "FrogsGoMoo":
candidate = "MOCK"