From b5dbdfd32391739928c0d6c8e5f80e2975057ed0 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Mon, 15 Jun 2026 12:15:57 +0800 Subject: [PATCH] 2026-06-15: fix(dragonpilot.py): make sure it load/show vehicle specific settings --- .../ui/layouts/settings/dragonpilot.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dragonpilot/selfdrive/ui/layouts/settings/dragonpilot.py b/dragonpilot/selfdrive/ui/layouts/settings/dragonpilot.py index 8e4886ba..417e649c 100644 --- a/dragonpilot/selfdrive/ui/layouts/settings/dragonpilot.py +++ b/dragonpilot/selfdrive/ui/layouts/settings/dragonpilot.py @@ -239,7 +239,27 @@ class DragonpilotLayout(Widget): dialog = ConfirmDialog(tr("Are you sure you want to reset ALL DP SETTINGS to default?"), tr("Reset"), callback=reset_dp_conf) gui_app.push_widget(dialog) + def _refresh_visibility(self): + # ui_state.CP is None when this panel is first built (the UI starts before the car is up), + # so brand/longitudinal-gated sections would be filtered out and never come back. Re-read CP + # when the menu is shown and rebuild the section list if it changed. CP comes from + # CarParamsPersistent, so this also works offroad once the car has been identified once. + brand = ui_state.CP.brand if ui_state.CP is not None else "" + oplong = ui_state.CP.openpilotLongitudinalControl if ui_state.CP is not None else False + if brand == self._brand and oplong == self._openpilot_longitudinal_control: + return + self._brand = brand + self._openpilot_longitudinal_control = oplong + self._toggles = {} + self._toggle_metadata = {} + self._defaults = {} + self._reverse_deps = {} + self._load_settings() + self._toggles['btn_reset_dp_conf'] = self._reset_dp_conf_btn + self._scroller = Scroller(list(self._toggles.values()), line_separator=True, spacing=0) + def show_event(self): + self._refresh_visibility() self._scroller.show_event() self._update_toggles()