Files
StarPilot/selfdrive/selfdrived/alert_sound.py
T
firestar5683 9910651a9d Carl The Witch
2026-06-20 14:38:56 -05:00

20 lines
669 B
Python

from cereal import car
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
def filter_forcing_stop_alert_sound(alert_type, audible_alert, forcing_stop, chime_played):
is_forcing_stop_alert = str(alert_type or "").startswith("forcingStop/")
if not forcing_stop:
# Silence the alert manager's short holdover so the next force-stop cycle
# starts from a clean sound transition.
return (AudibleAlert.none if is_forcing_stop_alert else audible_alert), False
if not is_forcing_stop_alert or audible_alert == AudibleAlert.none:
return audible_alert, chime_played
if chime_played:
return AudibleAlert.none, True
return audible_alert, True