mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-11-03 03:03:43 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a6a837735d | |||
| a5f6fb2f1f | |||
| a5bcc1e8d5 | |||
| 26a4a2ef06 |
+1
-1
Submodule opendbc_repo updated: f88092fed4...1ebba7c6c6
@@ -239,6 +239,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"BackupManager_RestoreVersion", {PERSISTENT, STRING}},
|
||||
|
||||
// sunnypilot car specific params
|
||||
{"HyundaiCcncHideFaults", {PERSISTENT | BACKUP, BOOL, "1"}},
|
||||
{"HyundaiLongitudinalTuning", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"SubaruStopAndGo", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"SubaruStopAndGoManualParkingBrake", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
|
||||
@@ -300,6 +300,7 @@ class Car:
|
||||
|
||||
# sunnypilot
|
||||
self.v_cruise_helper.read_custom_set_speed_params()
|
||||
sunnypilot_interfaces.update_live_params(self.CP, self.CP_SP, self.params)
|
||||
|
||||
time.sleep(0.1)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ See the LICENSE.md file in the root directory for more details.
|
||||
from openpilot.selfdrive.ui.mici.layouts.settings import settings as OP
|
||||
from openpilot.selfdrive.ui.mici.layouts.settings.settings import SettingsBigButton
|
||||
from openpilot.selfdrive.ui.mici.layouts.settings.device.device_layout import DeviceLayoutMici
|
||||
from openpilot.selfdrive.ui.mici.widgets.button import BigCircleButton
|
||||
from openpilot.selfdrive.ui.mici.widgets.button import BigCircleButton, BigParamControl
|
||||
from openpilot.selfdrive.ui.mici.widgets.dialog import BigConfirmationDialog, BigDialog
|
||||
from openpilot.selfdrive.ui.sunnypilot.mici.layouts.sunnylink import SunnylinkLayoutMici
|
||||
from openpilot.selfdrive.ui.sunnypilot.mici.layouts.models import ModelsLayoutMici
|
||||
@@ -50,6 +50,8 @@ class SettingsLayoutSP(OP.SettingsLayout):
|
||||
models_btn = SettingsBigButton(tr("models"), "", gui_app.texture("../../sunnypilot/selfdrive/assets/offroad/icon_models.png", ICON_SIZE, ICON_SIZE))
|
||||
models_btn.set_click_callback(lambda: gui_app.push_widget(models_panel))
|
||||
|
||||
self._ccnc_faults_toggle = BigParamControl(tr("hide ccnc faults"), "HyundaiCcncHideFaults")
|
||||
|
||||
# onroad: enable button sits at the front (left of toggles)
|
||||
self._enable_offroad_btn_onroad = BigCircleButton(self.icon_offroad_enable, red=True)
|
||||
self._enable_offroad_btn_onroad.set_click_callback(lambda: self._handle_always_offroad(True))
|
||||
@@ -67,7 +69,8 @@ class SettingsLayoutSP(OP.SettingsLayout):
|
||||
items = self._scroller._items.copy()
|
||||
|
||||
items.insert(1, models_btn)
|
||||
items.insert(5, sunnylink_btn)
|
||||
items.insert(2, self._ccnc_faults_toggle)
|
||||
items.insert(6, sunnylink_btn)
|
||||
|
||||
# front slots (only one ever visible at a time): exit-always-offroad, then enable-onroad
|
||||
items.insert(0, self._enable_offroad_btn_onroad)
|
||||
@@ -79,6 +82,10 @@ class SettingsLayoutSP(OP.SettingsLayout):
|
||||
for item in items:
|
||||
self._scroller.add_widget(item)
|
||||
|
||||
def show_event(self):
|
||||
super().show_event()
|
||||
self._ccnc_faults_toggle.refresh()
|
||||
|
||||
def _update_state(self):
|
||||
super()._update_state()
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from typing import Any
|
||||
|
||||
from opendbc.car import structs
|
||||
from opendbc.car.interfaces import CarInterfaceBase
|
||||
from opendbc.sunnypilot.car.hyundai.values import HyundaiFlagsSP
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.helpers import get_nn_model_path
|
||||
@@ -102,11 +103,22 @@ def setup_interfaces(CI: CarInterfaceBase, params: Params | None = None) -> None
|
||||
# STATSLOGSP.raw('sunnypilot_params.car_params_sp', CP_SP.to_dict()) # https://github.com/sunnypilot/opendbc/pull/361
|
||||
|
||||
|
||||
def update_live_params(CP: structs.CarParams, CP_SP: structs.CarParamsSP, params: Params) -> None:
|
||||
# settings the car controller picks up while driving, no onroad cycle needed
|
||||
if CP.brand == 'hyundai':
|
||||
show_faults = HyundaiFlagsSP.CCNC_SHOW_FAULTS.value
|
||||
if params.get("HyundaiCcncHideFaults", return_default=True):
|
||||
CP_SP.flags &= ~show_faults
|
||||
else:
|
||||
CP_SP.flags |= show_faults
|
||||
|
||||
|
||||
def initialize_params(params) -> list[dict[str, Any]]:
|
||||
keys: list = []
|
||||
|
||||
# hyundai
|
||||
keys.extend([
|
||||
"HyundaiCcncHideFaults",
|
||||
"HyundaiLongitudinalTuning",
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user