Compare commits

..

1 Commits

Author SHA1 Message Date
github-actions[bot] dbf4fdde5c Update Python packages 2026-11-24 01:35:31 +00:00
6 changed files with 535 additions and 433 deletions
+1 -1
View File
@@ -239,7 +239,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"BackupManager_RestoreVersion", {PERSISTENT, STRING}},
// sunnypilot car specific params
{"HyundaiLongitudinalTuning", {PERSISTENT | BACKUP, BOOL, "0"}},
{"HyundaiLongitudinalTuning", {PERSISTENT | BACKUP, INT, "0"}},
{"SubaruStopAndGo", {PERSISTENT | BACKUP, BOOL, "0"}},
{"SubaruStopAndGoManualParkingBrake", {PERSISTENT | BACKUP, BOOL, "0"}},
{"TeslaCoopSteering", {PERSISTENT | BACKUP, BOOL, "0"}},
@@ -7,7 +7,7 @@ See the LICENSE.md file in the root directory for more details.
from openpilot.selfdrive.ui.sunnypilot.layouts.settings.vehicle.brands.base import BrandSettings
from openpilot.selfdrive.ui.ui_state import ui_state
from openpilot.system.ui.lib.multilang import tr
from openpilot.system.ui.sunnypilot.widgets.list_view import toggle_item_sp
from openpilot.system.ui.sunnypilot.widgets.list_view import multiple_button_item_sp
from opendbc.car.hyundai.values import CAR, UNSUPPORTED_LONGITUDINAL_CAR
@@ -16,9 +16,16 @@ class HyundaiSettings(BrandSettings):
super().__init__()
self.alpha_long_available = False
self.longitudinal_tuning_item = toggle_item_sp(tr("Custom Longitudinal Tuning"), "", param="HyundaiLongitudinalTuning")
tuning_texts = [tr("Off"), tr("Dynamic"), tr("Predictive")]
self.longitudinal_tuning_item = multiple_button_item_sp(tr("Custom Longitudinal Tuning"), "", tuning_texts,
button_width=300, callback=self._on_tuning_selected,
param="HyundaiLongitudinalTuning", inline=False)
self.items = [self.longitudinal_tuning_item]
@staticmethod
def _on_tuning_selected(index):
ui_state.params.put("HyundaiLongitudinalTuning", index)
def update_settings(self):
self.alpha_long_available = False
bundle = ui_state.params.get("CarPlatformBundle")
@@ -28,14 +35,25 @@ class HyundaiSettings(BrandSettings):
elif ui_state.CP is not None:
self.alpha_long_available = ui_state.CP.alphaLongitudinalAvailable
tuning_param = int(ui_state.params.get("HyundaiLongitudinalTuning") or "0")
long_enabled = ui_state.has_longitudinal_control
desc = tr("Accelerates and brakes the way your car's own cruise control does.")
if not ui_state.is_offroad():
desc = tr("This feature is unavailable while the car is onroad.")
elif not long_enabled:
desc = tr("This feature is unavailable because sunnypilot Longitudinal Control (Alpha) is not enabled.")
self.longitudinal_tuning_item.action_item.set_enabled(ui_state.is_offroad() and long_enabled)
self.longitudinal_tuning_item.set_description(desc)
long_tuning_descs = [
tr("Your vehicle will use the Default longitudinal tuning."),
tr("Your vehicle will use the Dynamic longitudinal tuning."),
tr("Your vehicle will use the Predictive longitudinal tuning."),
]
long_tuning_desc = long_tuning_descs[tuning_param] if tuning_param < len(long_tuning_descs) else long_tuning_descs[0]
longitudinal_tuning_disabled = not ui_state.is_offroad() or not long_enabled
if longitudinal_tuning_disabled:
if not ui_state.is_offroad():
long_tuning_desc = tr("This feature is unavailable while the car is onroad.")
elif not long_enabled:
long_tuning_desc = tr("This feature is unavailable because sunnypilot Longitudinal Control (Alpha) is not enabled.")
self.longitudinal_tuning_item.action_item.set_enabled(not longitudinal_tuning_disabled)
self.longitudinal_tuning_item.set_description(long_tuning_desc)
self.longitudinal_tuning_item.show_description(True)
self.longitudinal_tuning_item.action_item.set_selected_button(tuning_param)
self.longitudinal_tuning_item.set_visible(self.alpha_long_available)
@@ -2199,9 +2199,22 @@
"items": [
{
"key": "HyundaiLongitudinalTuning",
"widget": "toggle",
"widget": "multiple_button",
"title": "Custom Longitudinal Tuning",
"description": "Accelerates and brakes the way your car's own cruise control does.",
"options": [
{
"value": 0,
"label": "Off"
},
{
"value": 1,
"label": "Dynamic"
},
{
"value": 2,
"label": "Predictive"
}
],
"visibility": [
{
"type": "capability",
@@ -11,9 +11,15 @@ sections:
description: ''
items:
- key: HyundaiLongitudinalTuning
widget: toggle
widget: multiple_button
title: Custom Longitudinal Tuning
description: Accelerates and brakes the way your car's own cruise control does.
options:
- value: 0
label: 'Off'
- value: 1
label: Dynamic
- value: 2
label: Predictive
visibility:
- type: capability
field: hyundai_alpha_long_available
Generated
+483 -418
View File
File diff suppressed because it is too large Load Diff