Holiday Themes

This commit is contained in:
FrogAi
2024-03-05 17:44:50 -07:00
parent 7ef99716cc
commit ae0c294aab
171 changed files with 304 additions and 28 deletions

View File

@@ -11,6 +11,8 @@ from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.locationd.calibrationd import MIN_SPEED_FILTER
from openpilot.system.version import get_short_branch
params_memory = Params("/dev/shm/params")
AlertSize = log.ControlsState.AlertSize
AlertStatus = log.ControlsState.AlertStatus
VisualAlert = car.CarControl.HUDControl.VisualAlert
@@ -333,6 +335,29 @@ def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster,
# FrogPilot alerts
def holiday_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
holiday_messages = {
1: ("Happy April Fool's Day! 🤡", "aprilFoolsAlert"),
2: ("Merry Christmas! 🎄", "christmasAlert"),
3: ("¡Feliz Cinco de Mayo! 🌮", "cincoDeMayoAlert"),
4: ("Happy Easter! 🐰", "easterAlert"),
5: ("Happy Fourth of July! 🎆", "fourthOfJulyAlert"),
6: ("Happy Halloween! 🎃", "halloweenAlert"),
7: ("Happy New Year! 🎉", "newYearsDayAlert"),
8: ("Happy St. Patrick's Day! 🍀", "stPatricksDayAlert"),
9: ("Happy Thanksgiving! 🦃", "thanksgivingAlert"),
10: ("Happy Valentine's Day! ❤️", "valentinesDayAlert"),
11: ("Happy World Frog Day! 🐸", "worldFrogDayAlert"),
}
theme_id = params_memory.get_int("CurrentHolidayTheme")
message, alert_type = holiday_messages.get(theme_id, ("", ""))
return Alert(
message,
"",
AlertStatus.normal, AlertSize.small,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 5.)
EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
# ********** events with no alerts **********
@@ -974,6 +999,9 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 3.),
},
EventName.holidayActive: {
ET.PERMANENT: holiday_alert,
},
}