diff --git a/opendbc_repo b/opendbc_repo index 4b99eea067..4cbfd56b49 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 4b99eea067455c8698e94d5cd14585d012aa1a57 +Subproject commit 4cbfd56b499ca331b704d159274cce05427d18d4 diff --git a/openpilot/common/params_keys.h b/openpilot/common/params_keys.h index 4e2ffcab54..dce2b55ae3 100644 --- a/openpilot/common/params_keys.h +++ b/openpilot/common/params_keys.h @@ -189,6 +189,7 @@ inline static std::unordered_map keys = { {"TrueVEgoUI", {PERSISTENT | BACKUP, BOOL, "0"}}, // toyota specific params + {"ToyotaAutoHold", {PERSISTENT | BACKUP, BOOL, "0"}}, {"ToyotaEnhancedBsm", {PERSISTENT | BACKUP, BOOL, "0"}}, {"ToyotaTSS2Long", {PERSISTENT | BACKUP, BOOL, "0"}}, {"ToyotaDriveMode", {PERSISTENT | BACKUP, BOOL, "0"}}, diff --git a/openpilot/selfdrive/car/card.py b/openpilot/selfdrive/car/card.py index d9b7b4bb5a..78e5ab6cd0 100755 --- a/openpilot/selfdrive/car/card.py +++ b/openpilot/selfdrive/car/card.py @@ -11,7 +11,7 @@ from opendbc.car.structs import car from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper from openpilot.common.swaglog import cloudlog, ForwardingHandler - +from opendbc.safety import ALTERNATIVE_EXPERIENCE from opendbc.car import DT_CTRL, structs from opendbc.car.can_definitions import CanData, CanRecvCallable, CanSendCallable from opendbc.car.carlog import carlog @@ -122,7 +122,13 @@ class Car: self.CI, self.CP, self.CP_SP = CI, CI.CP, CI.CP_SP self.RI = RI + # set alternative experiences from parameters + sp_toyota_auto_brake_hold = self.params.get_bool("ToyotaAutoHold") self.CP.alternativeExperience = 0 + if sp_toyota_auto_brake_hold: + self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ALLOW_AEB + + # mads set_alternative_experience(self.CP, self.CP_SP, self.params) set_car_specific_params(self.CP, self.CP_SP, self.params) diff --git a/openpilot/sunnypilot/selfdrive/car/interfaces.py b/openpilot/sunnypilot/selfdrive/car/interfaces.py index e58ea66b6b..f0c6c385fb 100644 --- a/openpilot/sunnypilot/selfdrive/car/interfaces.py +++ b/openpilot/sunnypilot/selfdrive/car/interfaces.py @@ -137,6 +137,7 @@ def initialize_params(params) -> list[dict[str, Any]]: "ToyotaEnforceStockLongitudinal", "ToyotaStopAndGoHack", "ToyotaEnhancedBsm", + "ToyotaAutoHold", ]) return [{k: params.get(k, return_default=True)} for k in keys] diff --git a/openpilot/sunnypilot/sunnylink/settings_ui.json b/openpilot/sunnypilot/sunnylink/settings_ui.json index 89c15f6f8c..4e8b17e143 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": "ToyotaAutoHold", + "widget": "toggle", + "needs_onroad_cycle": true, + "title": "Toyota: Auto Brake Hold FOR TSS2 HYBRID CARS", + "enablement": [ + { + "type": "not_engaged" + } + ] + }, { "key": "ToyotaEnhancedBsm", "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 51042b4668..e9b73a1976 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: ToyotaAutoHold + widget: toggle + needs_onroad_cycle: true + title: 'Toyota: Auto Brake Hold FOR TSS2 HYBRID CARS' + enablement: + - $ref: '#/macros/not_engaged' - key: ToyotaEnhancedBsm widget: toggle needs_onroad_cycle: true