Invalid LKAS setting alert: custom text per brand (#35377)

* draft

* use it

* friendly

* clean up

* CC

* Apply suggestions from code review

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Update selfdrive/selfdrived/events.py

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
Shane Smiskol
2025-05-29 14:24:39 -07:00
committed by GitHub
parent ae5e87e915
commit a385ed59cf
+11 -2
View File
@@ -359,6 +359,16 @@ def personality_changed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging
return NormalPermanentAlert(f"Driving Personality: {personality}", duration=1.5)
def invalid_lkas_setting_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
text = "Toggle stock LKAS on or off to engage"
if CP.brand == "tesla":
text = "Switch to Traffic-Aware Cruise Control to engage"
elif CP.brand == "mazda":
text = "Enable your car's LKAS to engage"
elif CP.brand == "nissan":
text = "Disable your car's stock LKAS to engage"
return NormalPermanentAlert("Invalid LKAS setting", text)
EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
# ********** events with no alerts **********
@@ -412,8 +422,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
},
EventName.invalidLkasSetting: {
ET.PERMANENT: NormalPermanentAlert("Invalid LKAS setting",
"Toggle stock LKAS on or off to engage"),
ET.PERMANENT: invalid_lkas_setting_alert,
ET.NO_ENTRY: NoEntryAlert("Invalid LKAS setting"),
},