mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-05 08:16:03 +08:00
sunnylink: Vehicle Selector support (#1587)
* sunnylink: Vehicle Selector support * shebang
This commit is contained in:
@@ -139,6 +139,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"BlinkerMinLateralControlSpeed", {PERSISTENT | BACKUP, INT, "20"}}, // MPH or km/h
|
||||
{"BlinkerPauseLateralControl", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"Brightness", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"CarList", {PERSISTENT, JSON}},
|
||||
{"CarParamsSP", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, BYTES}},
|
||||
{"CarParamsSPCache", {CLEAR_ON_MANAGER_START, BYTES}},
|
||||
{"CarParamsSPPersistent", {PERSISTENT, BYTES}},
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
||||
|
||||
This file is part of sunnypilot and is licensed under the MIT License.
|
||||
See the LICENSE.md file in the root directory for more details.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
|
||||
CAR_LIST_JSON_OUT = os.path.join(BASEDIR, "sunnypilot", "selfdrive", "car", "car_list.json")
|
||||
|
||||
|
||||
def update_car_list_param():
|
||||
with open(CAR_LIST_JSON_OUT) as f:
|
||||
current_car_list = json.load(f)
|
||||
|
||||
params = Params()
|
||||
if params.get("CarList") != current_car_list:
|
||||
params.put("CarList", current_car_list)
|
||||
cloudlog.warning("Updated CarList param with latest platform list")
|
||||
else:
|
||||
cloudlog.warning("CarList param is up to date, no need to update")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
update_car_list_param()
|
||||
@@ -28,6 +28,7 @@ from websocket import (ABNF, WebSocket, WebSocketException, WebSocketTimeoutExce
|
||||
create_connection, WebSocketConnectionClosedException)
|
||||
|
||||
import cereal.messaging as messaging
|
||||
from openpilot.sunnypilot.selfdrive.car.sync_car_list_param import update_car_list_param
|
||||
from openpilot.sunnypilot.sunnylink.api import SunnylinkApi
|
||||
from openpilot.sunnypilot.sunnylink.utils import sunnylink_need_register, sunnylink_ready, get_param_as_byte, save_param_from_base64_encoded_string
|
||||
|
||||
@@ -279,6 +280,8 @@ def main(exit_event: threading.Event = None):
|
||||
sunnylink_api = SunnylinkApi(sunnylink_dongle_id)
|
||||
UploadQueueCache.initialize(upload_queue)
|
||||
|
||||
update_car_list_param()
|
||||
|
||||
ws_uri = f"{SUNNYLINK_ATHENA_HOST}"
|
||||
conn_start = None
|
||||
conn_retries = 0
|
||||
|
||||
@@ -125,6 +125,10 @@
|
||||
"title": "Car Battery Capacity",
|
||||
"description": ""
|
||||
},
|
||||
"CarList": {
|
||||
"title": "Supported Car List",
|
||||
"description": "All supported platform in sunnypilot"
|
||||
},
|
||||
"CarParams": {
|
||||
"title": "Car Params",
|
||||
"description": ""
|
||||
|
||||
Reference in New Issue
Block a user