mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 16:26:14 +08:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user