diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 716288a15..9db1e2081 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -194,6 +194,7 @@ class Controls: self.always_on_lateral_active = False self.drive_added = False + self.holiday_theme_alerted = False self.onroad_distance_pressed = False self.openpilot_crashed_triggered = False self.previous_traffic_mode = False @@ -924,6 +925,10 @@ class Controls: else: self.stopped_for_light = False + if not self.holiday_theme_alerted and self.frogpilot_toggles.current_holiday_theme != 0 and self.sm.frame * DT_CTRL >= 10: + self.events.add(EventName.holidayActive) + self.holiday_theme_alerted = True + if frogpilotPlan.leadDeparting: self.events.add(EventName.leadDeparting) diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 1b604487f..09af3a436 100755 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -346,6 +346,30 @@ 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.engage, 5.) + def no_lane_available_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: lane_width = sm['frogpilotPlan'].laneWidthLeft if CS.leftBlinker else sm['frogpilotPlan'].laneWidthRight lane_width_msg = f"{lane_width:.1f} meters" if metric else f"{lane_width * CV.METER_TO_FOOT:.1f} feet" @@ -1010,6 +1034,10 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { Priority.MID, VisualAlert.none, AudibleAlert.prompt, 3.), }, + EventName.holidayActive: { + ET.PERMANENT: holiday_alert, + }, + EventName.laneChangeBlockedLoud: { ET.WARNING: Alert( "Car detected in blindspot", diff --git a/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_flag.png new file mode 100644 index 000000000..c242059f6 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_home.png new file mode 100644 index 000000000..8df07383e Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_settings.png new file mode 100644 index 000000000..65ddf3f72 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/april_fools/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/disengage.wav new file mode 100644 index 000000000..362bb117a Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/engage.wav new file mode 100644 index 000000000..f40e8394c Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/prompt.wav b/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/prompt.wav new file mode 100644 index 000000000..4b4ce4193 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/april_fools/sounds/prompt.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_flag.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_home.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/christmas/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/christmas/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/christmas/sounds/disengage.wav new file mode 100644 index 000000000..ba583c41f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/christmas/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/christmas/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/christmas/sounds/engage.wav new file mode 100644 index 000000000..41e9b2d58 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/christmas/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_flag.png new file mode 100644 index 000000000..112ccb070 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_home.png new file mode 100644 index 000000000..112ccb070 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_settings.png new file mode 100644 index 000000000..70c4e0423 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/sounds/engage.wav new file mode 100644 index 000000000..ca80a719e Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/cinco_de_mayo/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_flag.png new file mode 100644 index 000000000..ba7e95bdf Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_home.png new file mode 100644 index 000000000..ba7e95bdf Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_settings.png new file mode 100644 index 000000000..9a74f945d Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_1.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_1.png new file mode 100644 index 000000000..ea181854f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_1.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_1_red.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_1_red.png new file mode 100644 index 000000000..748ea305f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_1_red.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_2.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_2.png new file mode 100644 index 000000000..4331e5f52 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_2.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_3.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_3.png new file mode 100644 index 000000000..1a7484fc4 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_3.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_4.png b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_4.png new file mode 100644 index 000000000..7514f2fc5 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/images/turn_signal_4.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/easter/sounds/disengage.wav new file mode 100644 index 000000000..f56a0f837 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/easter/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/easter/sounds/engage.wav new file mode 100644 index 000000000..a8dd79de4 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/easter/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_flag.png new file mode 100644 index 000000000..9d83e07ee Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_home.png new file mode 100644 index 000000000..9d83e07ee Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_settings.png new file mode 100644 index 000000000..3ba8f3055 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_1.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_1.png new file mode 100644 index 000000000..b62b5b7de Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_1.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_1_red.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_1_red.png new file mode 100644 index 000000000..1d006cb06 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_1_red.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_2.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_2.png new file mode 100644 index 000000000..acaa9c577 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_2.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_3.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_3.png new file mode 100644 index 000000000..9cae12549 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_3.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_4.png b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_4.png new file mode 100644 index 000000000..5c4f61638 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/images/turn_signal_4.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/disengage.wav new file mode 100644 index 000000000..6325750a0 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/engage.wav new file mode 100644 index 000000000..97aef0076 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_flag.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_home.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/halloween/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/halloween/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/halloween/sounds/disengage.wav new file mode 100644 index 000000000..ba583c41f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/halloween/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/halloween/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/halloween/sounds/engage.wav new file mode 100644 index 000000000..41e9b2d58 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/halloween/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_flag.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_home.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/new_years_day/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/sounds/disengage.wav new file mode 100644 index 000000000..ba583c41f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/new_years_day/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/sounds/engage.wav new file mode 100644 index 000000000..41e9b2d58 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/new_years_day/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_flag.png new file mode 100644 index 000000000..a6d195813 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_home.png new file mode 100644 index 000000000..a6d195813 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_settings.png new file mode 100644 index 000000000..7148616c5 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/sounds/disengage.wav new file mode 100644 index 000000000..6f95b6f2d Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/sounds/engage.wav new file mode 100644 index 000000000..fc13a3a8a Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/st_patricks_day/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_flag.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_home.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/disengage.wav new file mode 100644 index 000000000..ba583c41f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/engage.wav new file mode 100644 index 000000000..41e9b2d58 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/prompt.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/prompt.wav new file mode 100644 index 000000000..1ae77051e Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/prompt.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/prompt_distracted.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/prompt_distracted.wav new file mode 100644 index 000000000..c3d4475ca Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/prompt_distracted.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/refuse.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/refuse.wav new file mode 100644 index 000000000..0e80f7d12 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/refuse.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/warning_immediate.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/warning_immediate.wav new file mode 100644 index 000000000..b1815a958 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/warning_immediate.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/warning_soft.wav b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/warning_soft.wav new file mode 100644 index 000000000..261c7e137 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/thanksgiving/sounds/warning_soft.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_flag.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_home.png new file mode 100644 index 000000000..627af8aff Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/valentines_day/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/sounds/disengage.wav new file mode 100644 index 000000000..ba583c41f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/valentines_day/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/sounds/engage.wav new file mode 100644 index 000000000..41e9b2d58 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/valentines_day/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_flag.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_flag.png new file mode 100644 index 000000000..2658aa9b7 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_home.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_home.png new file mode 100644 index 000000000..2658aa9b7 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_settings.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_1.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_1.png new file mode 100644 index 000000000..43e0b446f Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_1.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_1_red.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_1_red.png new file mode 100644 index 000000000..7c102456e Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_1_red.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_2.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_2.png new file mode 100644 index 000000000..e8e147976 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_2.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_3.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_3.png new file mode 100644 index 000000000..b59b003f9 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_3.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_4.png b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_4.png new file mode 100644 index 000000000..c3c1d204e Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/images/turn_signal_4.png differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/sounds/disengage.wav new file mode 100644 index 000000000..d46dd9eb6 Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/sounds/engage.wav b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/sounds/engage.wav new file mode 100644 index 000000000..795aa530e Binary files /dev/null and b/selfdrive/frogpilot/assets/holiday_themes/world_frog_day/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/controls/lib/theme_manager.py b/selfdrive/frogpilot/controls/lib/theme_manager.py new file mode 100644 index 000000000..ec4d3ab13 --- /dev/null +++ b/selfdrive/frogpilot/controls/lib/theme_manager.py @@ -0,0 +1,72 @@ +import datetime + +from openpilot.common.params import Params + +from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import update_frogpilot_toggles + +class ThemeManager: + def __init__(self): + self.params_memory = Params("/dev/shm/params") + + self.previous_theme_id = 0 + + @staticmethod + def calculate_easter(year): + a = year % 19 + b = year // 100 + c = year % 100 + d = b // 4 + e = b % 4 + f = (b + 8) // 25 + g = (b - f + 1) // 3 + h = (19 * a + b - d - g + 15) % 30 + i = c // 4 + k = c % 4 + l = (32 + 2 * e + 2 * i - h - k) % 7 + m = (a + 11 * h + 22 * l) // 451 + month = (h + l - 7 * m + 114) // 31 + day = ((h + l - 7 * m + 114) % 31) + 1 + return datetime.datetime(year, month, day) + + @staticmethod + def calculate_thanksgiving(year): + november_first = datetime.datetime(year, 11, 1) + day_of_week = november_first.weekday() + return november_first + datetime.timedelta(days=(3 - day_of_week + 21) % 7 + 21) + + @staticmethod + def is_within_week_of(target_date, current_date): + start_of_week = target_date - datetime.timedelta(days=target_date.weekday()) + end_of_week = start_of_week + datetime.timedelta(days=6) + return start_of_week <= current_date <= end_of_week + + def update_holiday(self): + current_date = datetime.datetime.now() + year = current_date.year + + holidays = { + "april_fools": (datetime.datetime(year, 4, 1), 1), + "christmas_week": (datetime.datetime(year, 12, 25), 2), + "cinco_de_mayo": (datetime.datetime(year, 5, 5), 3), + "easter_week": (self.calculate_easter(year), 4), + "fourth_of_july": (datetime.datetime(year, 7, 4), 5), + "halloween_week": (datetime.datetime(year, 10, 31), 6), + "new_years": (datetime.datetime(year, 1, 1), 7), + "st_patricks": (datetime.datetime(year, 3, 17), 8), + "thanksgiving_week": (self.calculate_thanksgiving(year), 9), + "valentines": (datetime.datetime(year, 2, 14), 10), + "world_frog_day": (datetime.datetime(year, 3, 20), 11) + } + + for holiday, (date, theme_id) in holidays.items(): + if holiday.endswith("_week") and self.is_within_week_of(date, current_date) or current_date.date() == date.date(): + if theme_id != self.previous_theme_id: + self.params_memory.put_int("CurrentHolidayTheme", theme_id) + update_frogpilot_toggles() + self.previous_theme_id = theme_id + return + + if self.previous_theme_id != 0: + self.params_memory.put_int("CurrentHolidayTheme", "0") + update_frogpilot_toggles() + self.previous_theme_id = 0 diff --git a/selfdrive/frogpilot/frogpilot_process.py b/selfdrive/frogpilot/frogpilot_process.py index af6e79b31..f1f07afa5 100644 --- a/selfdrive/frogpilot/frogpilot_process.py +++ b/selfdrive/frogpilot/frogpilot_process.py @@ -12,6 +12,7 @@ from openpilot.selfdrive.frogpilot.controls.frogpilot_planner import FrogPilotPl from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import backup_toggles, is_url_pingable from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables from openpilot.selfdrive.frogpilot.controls.lib.model_manager import DEFAULT_MODEL, DEFAULT_MODEL_NAME, download_all_models, download_model, update_models +from openpilot.selfdrive.frogpilot.controls.lib.theme_manager import ThemeManager OFFLINE = log.DeviceState.NetworkType.none @@ -95,6 +96,7 @@ def frogpilot_thread(): params_storage = Params("/persist/params") frogpilot_planner = FrogPilotPlanner() + theme_manager = ThemeManager() run_time_checks = False started_previously = False @@ -156,6 +158,8 @@ def frogpilot_thread(): continue run_thread_with_lock("update_models", locks["update_models"], update_models, (params, params_memory)) + theme_manager.update_holiday() + def main(): frogpilot_thread() diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index 17ec2da1c..bde7b1237 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -277,7 +277,9 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s, c // lanelines for (int i = 0; i < std::size(scene.lane_line_vertices); ++i) { - if (customColors != 0) { + if (currentHolidayTheme != 0) { + painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second); + } else if (customColors != 0) { painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second); } else { painter.setBrush(QColor::fromRgbF(1.0, 1.0, 1.0, std::clamp(scene.lane_line_probs[i], 0.0, 0.7))); @@ -287,7 +289,9 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s, c // road edges for (int i = 0; i < std::size(scene.road_edge_vertices); ++i) { - if (customColors != 0) { + if (currentHolidayTheme != 0) { + painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second); + } else if (customColors != 0) { painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second); } else { painter.setBrush(QColor::fromRgbF(1.0, 0, 0, std::clamp(1.0 - scene.road_edge_stds[i], 0.0, 1.0))); @@ -319,7 +323,12 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s, c float lin_grad_point = (height() - scene.track_vertices[track_idx].y()) / height(); // If acceleration is between -0.25 and 0.25, resort to the theme color - if (std::abs(acceleration[i]) < 0.25 && (customColors != 0)) { + if (std::abs(acceleration[i]) < 0.25 && (currentHolidayTheme != 0)) { + const std::map &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]); + for (const std::pair &entry : colorMap) { + bg.setColorAt(entry.first, entry.second.color()); + } + } else if (std::abs(acceleration[i]) < 0.25 && (customColors != 0)) { const std::map &colorMap = std::get<2>(themeConfiguration[customColors]); for (const std::pair &entry : colorMap) { bg.setColorAt(entry.first, entry.second.color()); @@ -339,6 +348,11 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s, c i += (i + 2) < max_len ? 1 : 0; } } + } else if (currentHolidayTheme != 0) { + const std::map &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]); + for (const std::pair &entry : colorMap) { + bg.setColorAt(entry.first, entry.second.color()); + } } else if (customColors != 0) { const std::map &colorMap = std::get<2>(themeConfiguration[customColors]); for (const std::pair &entry : colorMap) { @@ -480,8 +494,8 @@ void AnnotatedCameraWidget::drawDriverState(QPainter &painter, const UIState *s) void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV3::Reader &lead_data, const QPointF &vd, const float v_ego) { painter.save(); - const float speedBuff = customColors != 0 ? 25. : 10.; // Make the center of the chevron appear sooner if a custom theme is active - const float leadBuff = customColors != 0 ? 100. : 40.; // Make the center of the chevron appear sooner if a custom theme is active + const float speedBuff = currentHolidayTheme != 0 || customColors != 0 ? 25. : 10.; // Make the center of the chevron appear sooner if a theme is active + const float leadBuff = currentHolidayTheme != 0 || customColors != 0 ? 100. : 40.; // Make the center of the chevron appear sooner if a theme is active const float d_rel = lead_data.getX()[0]; const float v_rel = lead_data.getV()[0] - v_ego; @@ -507,7 +521,9 @@ void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::ModelDataV // chevron QPointF chevron[] = {{x + (sz * 1.25), y + sz}, {x, y}, {x - (sz * 1.25), y + sz}}; - if (customColors != 0) { + if (currentHolidayTheme != 0) { + painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second); + } else if (customColors != 0) { painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second); } else { painter.setBrush(redColor(fillAlpha)); @@ -653,6 +669,42 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() { {1.0, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.1))}}}}, }; + holidayThemeConfiguration = { + {1, {"april_fools", QColor(255, 165, 0, 255), {{0.0, QBrush(QColor::fromHslF(39 / 360., 1.0, 0.5, 0.9))}, + {0.5, QBrush(QColor::fromHslF(39 / 360., 1.0, 0.5, 0.5))}, + {1.0, QBrush(QColor::fromHslF(39 / 360., 1.0, 0.5, 0.1))}}}}, + {2, {"christmas", QColor(0, 72, 255, 255), {{0.0, QBrush(QColor::fromHslF(223 / 360., 1.0, 0.5, 0.9))}, + {0.5, QBrush(QColor::fromHslF(223 / 360., 1.0, 0.5, 0.5))}, + {1.0, QBrush(QColor::fromHslF(223 / 360., 1.0, 0.5, 0.1))}}}}, + {3, {"cinco_de_mayo", QColor(0, 104, 71, 255), {{0.0, QBrush(QColor::fromHslF(161 / 360., 1.0, 0.2, 0.9))}, + {0.5, QBrush(QColor::fromHslF(161 / 360., 1.0, 0.2, 0.5))}, + {1.0, QBrush(QColor::fromHslF(161 / 360., 1.0, 0.2, 0.1))}}}}, + {4, {"easter", QColor(200, 150, 200, 255), {{0.0, QBrush(QColor::fromHslF(300 / 360., 0.31, 0.69, 0.9))}, + {0.5, QBrush(QColor::fromHslF(300 / 360., 0.31, 0.69, 0.5))}, + {1.0, QBrush(QColor::fromHslF(300 / 360., 0.31, 0.69, 0.1))}}}}, + {5, {"fourth_of_july", QColor(10, 49, 97, 255), {{0.0, QBrush(QColor::fromHslF(213 / 360., 0.81, 0.21, 0.9))}, + {0.5, QBrush(QColor::fromHslF(213 / 360., 0.81, 0.21, 0.5))}, + {1.0, QBrush(QColor::fromHslF(213 / 360., 0.81, 0.21, 0.1))}}}}, + {6, {"halloween", QColor(255, 0, 0, 255), {{0.0, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.9))}, + {0.5, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.5))}, + {1.0, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.1))}}}}, + {7, {"new_years_day", QColor(23, 134, 68, 242), {{0.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.9))}, + {0.5, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.5))}, + {1.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.1))}}}}, + {8, {"st_patricks_day", QColor(0, 128, 0, 255), {{0.0, QBrush(QColor::fromHslF(120 / 360., 1.0, 0.25, 0.9))}, + {0.5, QBrush(QColor::fromHslF(120 / 360., 1.0, 0.25, 0.5))}, + {1.0, QBrush(QColor::fromHslF(120 / 360., 1.0, 0.25, 0.1))}}}}, + {9, {"thanksgiving", QColor(255, 0, 0, 255), {{0.0, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.9))}, + {0.5, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.5))}, + {1.0, QBrush(QColor::fromHslF(0 / 360., 1.0, 0.5, 0.1))}}}}, + {10, {"valentines_day", QColor(23, 134, 68, 242), {{0.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.9))}, + {0.5, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.5))}, + {1.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.1))}}}}, + {11, {"world_frog_day", QColor(23, 134, 68, 242), {{0.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.9))}, + {0.5, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.5))}, + {1.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.1))}}}}, + }; + animationTimer = new QTimer(this); connect(animationTimer, &QTimer::timeout, this, [this] { animationFrameIndex = (animationFrameIndex + 1) % totalFrames; @@ -763,14 +815,21 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UISce animationTimer->stop(); } - if (customSignals != scene.custom_signals) { + if (currentHolidayTheme != scene.current_holiday_theme || customSignals != scene.custom_signals) { + currentHolidayTheme = scene.current_holiday_theme; customSignals = scene.custom_signals; QString themePath; - themePath = QString("../frogpilot/assets/custom_themes/%1/images").arg( - themeConfiguration.find(customSignals) != themeConfiguration.end() ? - std::get<0>(themeConfiguration[customSignals]) : ""); + if (currentHolidayTheme != 0) { + themePath = QString("../frogpilot/assets/holiday_themes/%1/images").arg( + holidayThemeConfiguration.find(currentHolidayTheme) != holidayThemeConfiguration.end() ? + std::get<0>(holidayThemeConfiguration[currentHolidayTheme]) : ""); + } else { + themePath = QString("../frogpilot/assets/custom_themes/%1/images").arg( + themeConfiguration.find(customSignals) != themeConfiguration.end() ? + std::get<0>(themeConfiguration[customSignals]) : ""); + } const QStringList imagePaths = { themePath + "/turn_signal_1.png", diff --git a/selfdrive/ui/qt/onroad/annotated_camera.h b/selfdrive/ui/qt/onroad/annotated_camera.h index 3561105d6..e4708d398 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.h +++ b/selfdrive/ui/qt/onroad/annotated_camera.h @@ -139,6 +139,7 @@ private: int conditionalSpeed; int conditionalSpeedLead; int conditionalStatus; + int currentHolidayTheme; int customColors; int customSignals; int totalFrames; @@ -152,6 +153,8 @@ private: size_t animationFrameIndex; std::unordered_map>> themeConfiguration; + std::unordered_map>> holidayThemeConfiguration; + std::vector signalImgVector; QTimer *animationTimer; diff --git a/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/qt/sidebar.cc index 68bf0294d..4a6315344 100644 --- a/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/qt/sidebar.cc @@ -43,6 +43,31 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed( UIState *s = uiState(); UIScene &scene = s->scene; + holidayThemeConfiguration = { + {0, {"stock", {QColor(255, 255, 255)}}}, + {1, {"april_fools", {QColor(255, 165, 0)}}}, + {2, {"christmas", {QColor(0, 72, 255)}}}, + {3, {"cinco_de_mayo", {QColor(0, 104, 71)}}}, + {4, {"easter", {QColor(200, 150, 200)}}}, + {5, {"fourth_of_july", {QColor(10, 49, 97)}}}, + {6, {"halloween", {QColor(255, 0, 0)}}}, + {7, {"new_years_day", {QColor(23, 134, 68)}}}, + {8, {"st_patricks_day", {QColor(0, 128, 0)}}}, + {9, {"thanksgiving", {QColor(255, 0, 0)}}}, + {10, {"valentines_day", {QColor(23, 134, 68)}}}, + {11, {"world_frog_day", {QColor(23, 134, 68)}}}, + }; + + for (auto &[key, themeData] : holidayThemeConfiguration) { + QString &themeName = themeData.first; + QString base = themeName == "stock" ? "../assets/images" : QString("../frogpilot/assets/holiday_themes/%1/images").arg(themeName); + std::vector paths = {base + "/button_home.png", base + "/button_flag.png", base + "/button_settings.png"}; + + holiday_home_imgs[key] = loadPixmap(paths[0], home_btn.size()); + holiday_flag_imgs[key] = loadPixmap(paths[1], home_btn.size()); + holiday_settings_imgs[key] = loadPixmap(paths[2], settings_btn.size(), Qt::IgnoreAspectRatio); + } + themeConfiguration = { {0, {"stock", {QColor(255, 255, 255)}}}, {1, {"frog_theme", {QColor(23, 134, 68)}}}, @@ -108,11 +133,17 @@ void Sidebar::updateState(const UIState &s) { // FrogPilot properties const UIScene &scene = s.scene; - home_img = home_imgs[scene.custom_icons]; - flag_img = flag_imgs[scene.custom_icons]; - settings_img = settings_imgs[scene.custom_icons]; - - currentColors = themeConfiguration[scene.custom_colors].second; + if (scene.current_holiday_theme != 0) { + home_img = holiday_home_imgs[scene.current_holiday_theme]; + flag_img = holiday_flag_imgs[scene.current_holiday_theme]; + settings_img = holiday_settings_imgs[scene.current_holiday_theme]; + currentColors = holidayThemeConfiguration[scene.current_holiday_theme].second; + } else { + home_img = home_imgs[scene.custom_icons]; + flag_img = flag_imgs[scene.custom_icons]; + settings_img = settings_imgs[scene.custom_icons]; + currentColors = themeConfiguration[scene.custom_colors].second; + } auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState(); diff --git a/selfdrive/ui/qt/sidebar.h b/selfdrive/ui/qt/sidebar.h index 4d96693fd..73d7c71da 100644 --- a/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/qt/sidebar.h @@ -68,5 +68,10 @@ private: std::unordered_map home_imgs; std::unordered_map settings_imgs; + std::unordered_map>> holidayThemeConfiguration; + std::unordered_map holiday_flag_imgs; + std::unordered_map holiday_home_imgs; + std::unordered_map holiday_settings_imgs; + std::vector currentColors; }; diff --git a/selfdrive/ui/soundd.py b/selfdrive/ui/soundd.py index 5843c5645..b5c8d9bd6 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -202,6 +202,20 @@ class Soundd: AudibleAlert.goat: self.frogpilot_toggles.prompt_volume, } + holiday_theme_configuration = { + 1: "april_fools", + 2: "christmas", + 3: "cinco_de_mayo", + 4: "easter", + 5: "fourth_of_july", + 6: "halloween", + 7: "new_years_day", + 8: "st_patricks_day", + 9: "thanksgiving", + 10: "valentines_day", + 11: "world_frog_day", + } + theme_configuration = { 0: "stock_theme", 1: "frog_theme", @@ -209,8 +223,12 @@ class Soundd: 3: "stalin_theme" } - theme_name = theme_configuration.get(self.frogpilot_toggles.custom_sounds) - self.sound_directory = BASEDIR + ("/selfdrive/frogpilot/assets/custom_themes/" + theme_name + "/sounds/" if theme_name != "stock_theme" else "/selfdrive/assets/sounds/") + if self.frogpilot_toggles.current_holiday_theme != 0: + theme_name = holiday_theme_configuration.get(self.frogpilot_toggles.current_holiday_theme) + self.sound_directory = BASEDIR + ("/selfdrive/frogpilot/assets/holiday_themes/" + theme_name + "/sounds/") + else: + theme_name = theme_configuration.get(self.frogpilot_toggles.custom_sounds) + self.sound_directory = BASEDIR + ("/selfdrive/frogpilot/assets/custom_themes/" + theme_name + "/sounds/" if theme_name != "stock_theme" else "/selfdrive/assets/sounds/") if self.sound_directory != self.previous_sound_directory: self.load_sounds() diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 40437d2d5..fae751388 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -335,6 +335,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { scene.custom_colors = custom_theme ? params.getInt("CustomColors") : 0; scene.custom_icons = custom_theme ? params.getInt("CustomIcons") : 0; scene.custom_signals = custom_theme ? params.getInt("CustomSignals") : 0; + scene.holiday_themes = custom_theme && params.getBool("HolidayThemes"); scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing"); scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing"); @@ -459,6 +460,7 @@ void UIState::update() { // FrogPilot variables that need to be constantly updated scene.conditional_status = scene.conditional_experimental && scene.enabled ? paramsMemory.getInt("CEStatus") : 0; + scene.current_holiday_theme = scene.holiday_themes ? paramsMemory.getInt("CurrentHolidayTheme") : 0; scene.started_timer = scene.started || started_prev ? scene.started_timer + 1 : 0; } diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 506f5f5b0..6af5affa6 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -139,6 +139,7 @@ typedef struct UIScene { bool experimental_mode; bool experimental_mode_via_screen; bool has_lead; + bool holiday_themes; bool map_open; bool model_randomizer; bool online; @@ -187,6 +188,7 @@ typedef struct UIScene { int conditional_speed; int conditional_speed_lead; int conditional_status; + int current_holiday_theme; int custom_colors; int custom_icons; int custom_signals;