From 4d7d9571e73c104dc97d4d65a93df1c0d62f3013 Mon Sep 17 00:00:00 2001 From: rav4kumar <36933347+rav4kumar@users.noreply.github.com> Date: Sat, 15 Aug 2026 03:03:36 -0700 Subject: [PATCH] feat(toyota): make TSS2 longitudinal response configurable --- opendbc_repo | 2 +- openpilot/common/params_keys.h | 3 +++ openpilot/sunnypilot/selfdrive/car/interfaces.py | 1 + .../selfdrive/car/tests/test_custom_cruise.py | 8 ++++++++ openpilot/sunnypilot/sunnylink/settings_ui.json | 11 +++++++++++ .../sunnylink/settings_ui_src/pages/vehicle.yaml | 6 ++++++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/opendbc_repo b/opendbc_repo index d28519b9f4..07f503c6ee 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit d28519b9f4dca2e4182114910b1bdd0fae8799a7 +Subproject commit 07f503c6eef557dcdb56e89732a0b51505110aa3 diff --git a/openpilot/common/params_keys.h b/openpilot/common/params_keys.h index 3fee8184b6..1a6383fdc9 100644 --- a/openpilot/common/params_keys.h +++ b/openpilot/common/params_keys.h @@ -187,6 +187,9 @@ inline static std::unordered_map keys = { {"StandstillTimer", {PERSISTENT | BACKUP, BOOL, "0"}}, {"TrueVEgoUI", {PERSISTENT | BACKUP, BOOL, "0"}}, + // toyota specific params + {"ToyotaTSS2Long", {PERSISTENT | BACKUP, BOOL, "0"}}, + // MADS params {"Mads", {PERSISTENT | BACKUP, BOOL, "1"}}, {"MadsMainCruiseAllowed", {PERSISTENT | BACKUP, BOOL, "1"}}, diff --git a/openpilot/sunnypilot/selfdrive/car/interfaces.py b/openpilot/sunnypilot/selfdrive/car/interfaces.py index 4988e863b1..c748984ae6 100644 --- a/openpilot/sunnypilot/selfdrive/car/interfaces.py +++ b/openpilot/sunnypilot/selfdrive/car/interfaces.py @@ -136,6 +136,7 @@ def initialize_params(params) -> list[dict[str, Any]]: keys.extend([ "ToyotaEnforceStockLongitudinal", "ToyotaStopAndGoHack", + "ToyotaTSS2Long", ]) return [{k: params.get(k, return_default=True)} for k in keys] diff --git a/openpilot/sunnypilot/selfdrive/car/tests/test_custom_cruise.py b/openpilot/sunnypilot/selfdrive/car/tests/test_custom_cruise.py index 56491e3518..3099cf798d 100644 --- a/openpilot/sunnypilot/selfdrive/car/tests/test_custom_cruise.py +++ b/openpilot/sunnypilot/selfdrive/car/tests/test_custom_cruise.py @@ -2,13 +2,21 @@ from opendbc.car.structs import car from openpilot.common.constants import CV from openpilot.common.parameterized import parameterized, parameterized_class from openpilot.common.params import Params +from openpilot.common.test import OpenpilotTestCase from openpilot.selfdrive.car.cruise import V_CRUISE_INITIAL from openpilot.selfdrive.car.tests.test_cruise_speed import TestVCruiseHelper +from openpilot.sunnypilot.selfdrive.car.interfaces import initialize_params ButtonEvent = car.CarState.ButtonEvent ButtonType = car.CarState.ButtonEvent.Type +class TestToyotaParamsHandoff(OpenpilotTestCase): + def test_tss2_long_tuning_param_is_forwarded_to_opendbc(self): + keys = {next(iter(entry)) for entry in initialize_params(Params())} + assert "ToyotaTSS2Long" in keys + + # TODO: test pcmCruise and pcmCruiseSpeed @parameterized_class(('pcm_cruise', 'pcm_cruise_speed'), [(False, True)]) class TestCustomAccIncrements(TestVCruiseHelper): diff --git a/openpilot/sunnypilot/sunnylink/settings_ui.json b/openpilot/sunnypilot/sunnylink/settings_ui.json index a0957ee83c..b541dea21d 100644 --- a/openpilot/sunnypilot/sunnylink/settings_ui.json +++ b/openpilot/sunnypilot/sunnylink/settings_ui.json @@ -2370,6 +2370,17 @@ "title": "Toyota / Lexus Settings", "description": "", "items": [ + { + "key": "ToyotaTSS2Long", + "widget": "toggle", + "needs_onroad_cycle": true, + "title": "Toyota: custom longitudinal for TSS2", + "enablement": [ + { + "type": "not_engaged" + } + ] + }, { "key": "ToyotaEnforceStockLongitudinal", "widget": "toggle", diff --git a/openpilot/sunnypilot/sunnylink/settings_ui_src/pages/vehicle.yaml b/openpilot/sunnypilot/sunnylink/settings_ui_src/pages/vehicle.yaml index 7dd23256b1..079efb0c0b 100644 --- a/openpilot/sunnypilot/sunnylink/settings_ui_src/pages/vehicle.yaml +++ b/openpilot/sunnypilot/sunnylink/settings_ui_src/pages/vehicle.yaml @@ -82,6 +82,12 @@ sections: title: Toyota / Lexus Settings description: '' items: + - key: ToyotaTSS2Long + widget: toggle + needs_onroad_cycle: true + title: 'Toyota: custom longitudinal for TSS2' + enablement: + - $ref: '#/macros/not_engaged' - key: ToyotaEnforceStockLongitudinal widget: toggle needs_onroad_cycle: true