From 741237f6e2f673dc8ec75579c8841284a10e6a3e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 7 Nov 2023 20:05:37 +0000 Subject: [PATCH] FCR: Reset cached param to sync with upstream conflicts --- selfdrive/car/car_helpers.py | 31 ++++++++++++++++++++----------- selfdrive/controls/lib/events.py | 4 ++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 376b7b48d8..ef53cb0c19 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -1,3 +1,4 @@ +import json import os import requests import threading @@ -233,19 +234,27 @@ def crash_log2(fingerprints, fw): def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1): candidate, fingerprints, vin, car_fw, source, exact_match = fingerprint(logcan, sendcan, num_pandas) - params = Params() - if params.get("CarModel") is not None: - car_model = params.get("CarModel") - candidate = car_model.decode("utf-8") - if candidate is None: - cloudlog.event("car doesn't match any fingerprints", fingerprints=fingerprints, error=True) - candidate = "mock" - y = threading.Thread(target=crash_log2, args=(fingerprints, car_fw,)) - y.start() + params = Params() + car_model = params.get("CarModel") + if car_model is not None: + car_model = car_model.decode("utf-8").rstrip() + with open(os.path.join(BASEDIR, "selfdrive/car/sunnypilot_carname.json")) as f: + car_models = json.load(f) + if car_model in car_models.values(): + candidate = car_model + else: + params.put("CarModel", "") + params.put("CarModelText", "") + if candidate is None: + cloudlog.event("car doesn't match any fingerprints", fingerprints=fingerprints, error=True) + candidate = "mock" + y = threading.Thread(target=crash_log2, args=(fingerprints, car_fw,)) + y.start() - x = threading.Thread(target=crash_log, args=(candidate,)) - x.start() + if candidate != "mock": + x = threading.Thread(target=crash_log, args=(candidate,)) + x.start() CarInterface, CarController, CarState = interfaces[candidate] CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed, docs=False) diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 5dde23e2c3..9a7dff6a78 100755 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -402,8 +402,8 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { # read-only mode. This can be solved by adding your fingerprint. # See https://github.com/commaai/openpilot/wiki/Fingerprinting for more information EventName.carUnrecognized: { - ET.PERMANENT: NormalPermanentAlert("Dashcam Mode", - "Car Unrecognized", + ET.PERMANENT: NormalPermanentAlert("Car Unrecognized", + "Vehicle Settings, Select, and Restart the Car", priority=Priority.LOWEST), },