From b6df4409ac89e98512979bb8fc55838ce940bfda Mon Sep 17 00:00:00 2001 From: 1okko <15377594951@189.cn> Date: Tue, 29 Sep 2026 21:28:49 +0800 Subject: [PATCH] fix(c3xl-vip): rebuild params after branch switch --- docs/qnn_wifi.md | 4 ++++ launch_chffrplus.sh | 7 +++++++ openpilot/system/manager/process_config.py | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/qnn_wifi.md b/docs/qnn_wifi.md index 572763709..fc8ea611a 100644 --- a/docs/qnn_wifi.md +++ b/docs/qnn_wifi.md @@ -23,6 +23,10 @@ 3. 保持 `QNN control preference` 关闭进行 shadow 验证;只有独立资格记录通过后才允许控制输出接管。 4. 每次 onroad 首次失败会写入 `C3XLQnnWifiFailedThisOnroad` 并锁定本地模型到本次行车结束。 +## 分支切换 + +从旧的 `c3xl-dev` 或任何还没有 QNN 参数/原生组件的分支切到本分支时,必须重新执行 `build.py`/`scons`。启动脚本会检测 `C3XLQnnWifiEnabled` 是否已编译进 Params,发现缺失时自动强制重建一次,避免 manager 因 `UnknownKeyName` 启动失败。 + ## 构建注意 启用后会通过 `openpilot/sunnypilot/SConscript` 编译 `external_host/opif/SConscript`,生成 `opif_native` 和 C3XL 用的 `wifi_power_ctl`。Android 端模型 ABI 是 Cinque v3,不是普通 supercombo pkl 的直接替换。 diff --git a/launch_chffrplus.sh b/launch_chffrplus.sh index 88bfedf9f..0ba5ef8f7 100755 --- a/launch_chffrplus.sh +++ b/launch_chffrplus.sh @@ -124,6 +124,13 @@ function launch { # start manager cd openpilot/system/manager + # A branch switch can add Params keys or native sources while an old + # prebuilt library is still present. Detect the schema mismatch before + # manager starts and force one rebuild instead of crashing on UnknownKeyName. + if [ -f "$DIR/prebuilt" ] && ! PYTHONPATH="$DIR" python3 -c 'from openpilot.common.params import Params; Params().get_bool("C3XLQnnWifiEnabled")' >/dev/null 2>&1; then + echo "[bootstrap] Params schema changed; forcing rebuild" + rm -f "$DIR/prebuilt" + fi if [ ! -f $DIR/prebuilt ]; then ./build.py fi diff --git a/openpilot/system/manager/process_config.py b/openpilot/system/manager/process_config.py index 4a9e719c6..c5e164980 100644 --- a/openpilot/system/manager/process_config.py +++ b/openpilot/system/manager/process_config.py @@ -93,7 +93,14 @@ def is_stock_model(started, params, CP: car.CarParams) -> bool: return bool(get_active_model_runner(params, not started) == custom.ModelManagerSP.Runner.stock) def c3xl_qnn_discovery(started, params: Params, CP: car.CarParams) -> bool: - return get_hardware_profile() == HardwareProfile.C3XL and params.get_bool('C3XLQnnWifiEnabled') + if get_hardware_profile() != HardwareProfile.C3XL: + return False + try: + return params.get_bool('C3XLQnnWifiEnabled') + except Exception: + # Older compiled Params libraries do not know this key yet. The launcher + # forces a rebuild, and manager must still be able to start in the meantime. + return False def mapd_ready(started: bool, params: Params, CP: car.CarParams) -> bool: