diff --git a/release/files_common b/release/files_common index 5bcaf33..ea7d403 100644 --- a/release/files_common +++ b/release/files_common @@ -573,5 +573,6 @@ selfdrive/frogpilot/controls/lib/frogpilot_variables.py selfdrive/frogpilot/controls/lib/map_turn_speed_controller.py selfdrive/frogpilot/controls/lib/model_manager.py selfdrive/frogpilot/controls/lib/speed_limit_controller.py +selfdrive/frogpilot/controls/lib/theme_manager.py selfdrive/frogpilot/fleet_manager/fleet_manager.py selfdrive/frogpilot/navigation/mapd.py diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 5d59041..526c68b 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -73,6 +73,7 @@ class Controls: self.frogpilot_toggles = FrogPilotVariables.toggles self.drive_added = False + self.holiday_theme_alerted = False self.onroad_distance_pressed = False self.openpilot_crashed_triggered = False self.previously_enabled = False @@ -949,6 +950,10 @@ class Controls: if self.green_light_mac.get_moving_average() >= PROBABILITY: self.events.add(EventName.greenLight) + if self.sm.frame >= 1000 and self.frogpilot_toggles.current_holiday_theme != 0 and not self.holiday_theme_alerted: + self.events.add(EventName.holidayActive) + self.holiday_theme_alerted = True + if self.frogpilot_toggles.lead_departing_alert and self.sm['frogpilotPlan'].leadDeparting: self.events.add(EventName.leadDeparting) diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py old mode 100755 new mode 100644 index b472759..44a1d17 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -352,6 +352,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.none, 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" @@ -1006,6 +1030,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 0000000..758a824 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 0000000..6337bd4 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 0000000..65ddf3f 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 0000000..362bb11 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 0000000..f40e839 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 0000000..4b4ce41 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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 0000000..ba583c4 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 0000000..41e9b2d 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 0000000..dd07122 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 0000000..dd07122 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 0000000..70c4e04 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 0000000..ca80a71 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 0000000..6f8b178 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 0000000..6f8b178 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 0000000..9a74f94 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 0000000..ea18185 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 0000000..748ea30 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 0000000..4331e5f 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 0000000..1a7484f 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 0000000..7514f2f 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 0000000..f56a0f8 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 0000000..a8dd79d 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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/sounds/disengage.wav b/selfdrive/frogpilot/assets/holiday_themes/fourth_of_july/sounds/disengage.wav new file mode 100644 index 0000000..ba583c4 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 0000000..41e9b2d 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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 0000000..ba583c4 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 0000000..41e9b2d 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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 0000000..ba583c4 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 0000000..41e9b2d 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 0000000..ada686a 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 0000000..ada686a 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 0000000..7148616 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 0000000..6f95b6f 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 0000000..fc13a3a 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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 0000000..ba583c4 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 0000000..41e9b2d 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 0000000..1ae7705 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 0000000..c3d4475 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 0000000..0e80f7d 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 0000000..b1815a9 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 0000000..261c7e1 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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 0000000..ba583c4 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 0000000..41e9b2d 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 0000000..627af8a 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 0000000..627af8a 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 0000000..5592759 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 0000000..43e0b44 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 0000000..7c10245 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 0000000..e8e1479 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 0000000..b59b003 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 0000000..c3c1d20 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 0000000..d46dd9e 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 0000000..795aa53 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 0000000..5e13d43 --- /dev/null +++ b/selfdrive/frogpilot/controls/lib/theme_manager.py @@ -0,0 +1,89 @@ +import datetime +import time +import threading + +from openpilot.common.params import Params + +class ThemeManager: + def __init__(self): + self.params = Params() + 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): + fourth_thursday = 4 + november_first = datetime.datetime(year, 11, 1) + day_of_week = november_first.weekday() + thanksgiving = november_first + datetime.timedelta(days=((fourth_thursday - day_of_week) % 7) + 21) + return thanksgiving + + @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"): + if self.is_within_week_of(date, current_date): + if theme_id != self.previous_theme_id: + update_holiday = threading.Thread(target=self.update_holiday_theme, args=(theme_id,)) + update_holiday.start() + self.previous_theme_id = theme_id + return + + elif current_date.date() == date.date(): + if theme_id != self.previous_theme_id: + update_holiday = threading.Thread(target=self.update_holiday_theme, args=(theme_id,)) + update_holiday.start() + self.previous_theme_id = theme_id + return + + if self.previous_theme_id != 0: + update_holiday = threading.Thread(target=self.update_holiday_theme, args=(0,)) + update_holiday.start() + self.previous_theme_id = 0 + + def update_holiday_theme(self, theme_id): + self.params_memory.put_int("CurrentHolidayTheme", theme_id) + self.params_memory.put_bool("FrogPilotTogglesUpdated", True) + time.sleep(1) + self.params_memory.put_bool("FrogPilotTogglesUpdated", False) diff --git a/selfdrive/frogpilot/frogpilot_process.py b/selfdrive/frogpilot/frogpilot_process.py index 0b60096..e0ae577 100644 --- a/selfdrive/frogpilot/frogpilot_process.py +++ b/selfdrive/frogpilot/frogpilot_process.py @@ -18,6 +18,7 @@ from openpilot.selfdrive.frogpilot.controls.frogpilot_planner import FrogPilotPl from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import FrogPilotFunctions 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_model, populate_models +from openpilot.selfdrive.frogpilot.controls.lib.theme_manager import ThemeManager WIFI = log.DeviceState.NetworkType.wifi @@ -80,6 +81,7 @@ def frogpilot_thread(frogpilot_toggles): frogpilot_functions = FrogPilotFunctions() frogpilot_planner = FrogPilotPlanner() + theme_manager = ThemeManager() current_day = None @@ -134,6 +136,8 @@ def frogpilot_thread(frogpilot_toggles): params.remove("FingerprintLogged") current_day = now.day + theme_manager.update_holiday() + first_run = False time.sleep(DT_MDL) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 4143ae6..c499f76 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -645,7 +645,9 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // 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))); @@ -655,7 +657,9 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // 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))); @@ -685,7 +689,12 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { float lin_grad_point = (height() - scene.track_vertices[i].y()) / height(); // If acceleration is between -0.25 and 0.25, resort to the theme color - if (std::abs(acceleration[i]) < 0.2 && (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()); @@ -705,6 +714,11 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { 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) { @@ -817,8 +831,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; @@ -844,7 +858,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)); @@ -985,6 +1001,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(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))}}}}, + {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; @@ -1052,14 +1104,21 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets() { turnSignalLeft = scene.turn_signal_left; turnSignalRight = scene.turn_signal_right; - 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.h b/selfdrive/ui/qt/onroad.h index 22dd785..bfa5b7f 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -232,6 +232,7 @@ private: int alertSize; int conditionalStatus; + int currentHolidayTheme; int customColors; int customSignals; int totalFrames = 8; @@ -243,6 +244,7 @@ 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 22f2345..2dcf975 100644 --- a/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/qt/sidebar.cc @@ -40,6 +40,31 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed( pm = std::make_unique>({"userFlag"}); // FrogPilot variables + 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(0, 72, 255)}}}, + {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)}}}, @@ -103,11 +128,17 @@ void Sidebar::updateState(const UIState &s) { setProperty("netStrength", strength > 0 ? strength + 1 : 0); // FrogPilot properties - 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 407a7ad..6d65c63 100644 --- a/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/qt/sidebar.h @@ -69,5 +69,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 c2ea160..0ce8f71 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -198,6 +198,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", @@ -205,8 +219,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 57303e0..67c153d 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -320,6 +320,7 @@ void ui_update_frogpilot_params(UIState *s) { 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"); @@ -417,6 +418,7 @@ void UIState::update() { // FrogPilot live variables that need to be constantly checked scene.conditional_status = scene.conditional_experimental && scene.enabled ? paramsMemory.getInt("CEStatus") : 0; + scene.current_holiday_theme = scene.holiday_themes ? paramsMemory.getInt("CurrentHolidayTheme") : 0; } void UIState::setPrimeType(PrimeType type) { diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 31159d0..bd655f2 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -202,6 +202,7 @@ typedef struct UIScene { bool enabled; bool experimental_mode; bool experimental_mode_via_screen; + bool holiday_themes; bool map_open; bool online; bool onroad_distance_button; @@ -245,6 +246,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;