mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-20 09:12:05 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5262f1785 | |||
| 25bea8e9e3 | |||
| 71372410c3 | |||
| ddb2dc9d0c | |||
| bcec06810c | |||
| 00c0b24fb0 | |||
| 0211f1adac | |||
| 10bf1c4d2c | |||
| 6f91271ca7 | |||
| cb742e3cbd | |||
| d5b7d79c79 |
@@ -213,6 +213,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"BackupManager_RestoreVersion", {PERSISTENT, STRING}},
|
||||
|
||||
// sunnypilot car specific params
|
||||
{"HondaEnforceStockLongitudinal", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"HyundaiLongitudinalTuning", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"SubaruStopAndGo", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"SubaruStopAndGoManualParkingBrake", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
|
||||
+1
-1
Submodule opendbc_repo updated: 613a562bba...7581c0d456
@@ -5,11 +5,52 @@ 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.
|
||||
"""
|
||||
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.application import gui_app
|
||||
from openpilot.system.ui.lib.multilang import tr, tr_noop
|
||||
from openpilot.system.ui.widgets import DialogResult
|
||||
from openpilot.system.ui.widgets.confirm_dialog import ConfirmDialog
|
||||
from openpilot.system.ui.sunnypilot.widgets.list_view import toggle_item_sp
|
||||
|
||||
DESCRIPTIONS = {
|
||||
'enforce_stock_longitudinal': tr_noop(
|
||||
'sunnypilot will not take over control of gas and brakes. Factory Honda Nidec longitudinal control will be used.'
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
class HondaSettings(BrandSettings):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.enforce_stock_longitudinal = toggle_item_sp(
|
||||
lambda: tr("Nidec: Enforce Factory Longitudinal Control"),
|
||||
description=lambda: tr(DESCRIPTIONS["enforce_stock_longitudinal"]),
|
||||
initial_state=ui_state.params.get_bool("HondaEnforceStockLongitudinal"),
|
||||
callback=self._on_enable_enforce_stock_longitudinal,
|
||||
enabled=lambda: not ui_state.engaged,
|
||||
)
|
||||
|
||||
self.items = [self.enforce_stock_longitudinal, ]
|
||||
|
||||
def _on_enable_enforce_stock_longitudinal(self, state: bool):
|
||||
if state:
|
||||
def confirm_callback(result: int):
|
||||
if result == DialogResult.CONFIRM:
|
||||
ui_state.params.put_bool("HondaEnforceStockLongitudinal", True)
|
||||
ui_state.params.put_bool("OnroadCycleRequested", True)
|
||||
else:
|
||||
self.enforce_stock_longitudinal.action_item.set_state(False)
|
||||
|
||||
content = (f"<h1>{self.enforce_stock_longitudinal.title}</h1><br>" +
|
||||
f"<p>{self.enforce_stock_longitudinal.description}</p>")
|
||||
|
||||
dlg = ConfirmDialog(content, tr("Enable"), rich=True)
|
||||
gui_app.set_modal_overlay(dlg, callback=confirm_callback)
|
||||
|
||||
else:
|
||||
ui_state.params.put_bool("HondaEnforceStockLongitudinal", False)
|
||||
ui_state.params.put_bool("OnroadCycleRequested", True)
|
||||
|
||||
def update_settings(self):
|
||||
pass
|
||||
|
||||
@@ -112,6 +112,11 @@ def setup_interfaces(CI: CarInterfaceBase, params: Params = None) -> None:
|
||||
def initialize_params(params) -> list[dict[str, Any]]:
|
||||
keys: list = []
|
||||
|
||||
# honda
|
||||
keys.extend([
|
||||
"HondaEnforceStockLongitudinal",
|
||||
])
|
||||
|
||||
# hyundai
|
||||
keys.extend([
|
||||
"HyundaiLongitudinalTuning",
|
||||
|
||||
@@ -374,6 +374,10 @@
|
||||
"title": "[TIZI/TICI only] Speedometer: Hide from Onroad Screen",
|
||||
"description": "When enabled, the speedometer on the onroad screen is not displayed."
|
||||
},
|
||||
"HondaEnforceStockLongitudinal": {
|
||||
"title": "Honda Nidec: Enforce Factory Longitudinal Control",
|
||||
"description": "When enabled, sunnypilot will not take over control of gas and brakes. Factory Honda Nidec longitudinal control will be used."
|
||||
},
|
||||
"HyundaiLongitudinalTuning": {
|
||||
"title": "Hyundai Longitudinal Tuning",
|
||||
"description": "",
|
||||
|
||||
Reference in New Issue
Block a user