diff --git a/frogpilot/assets/other_images/frogpilot_boot_logo.jpg b/frogpilot/assets/other_images/frogpilot_boot_logo.jpg new file mode 100644 index 00000000..5fe0604e Binary files /dev/null and b/frogpilot/assets/other_images/frogpilot_boot_logo.jpg differ diff --git a/frogpilot/assets/other_images/stock_bg.jpg b/frogpilot/assets/other_images/stock_bg.jpg new file mode 100644 index 00000000..13c36a7e Binary files /dev/null and b/frogpilot/assets/other_images/stock_bg.jpg differ diff --git a/frogpilot/common/frogpilot_functions.py b/frogpilot/common/frogpilot_functions.py index e5fc603f..2068c712 100644 --- a/frogpilot/common/frogpilot_functions.py +++ b/frogpilot/common/frogpilot_functions.py @@ -2,9 +2,14 @@ import threading import time +from pathlib import Path + +from openpilot.common.basedir import BASEDIR from openpilot.common.time_helpers import system_time_valid from openpilot.system.hardware import HARDWARE +from openpilot.frogpilot.common.frogpilot_utilities import run_cmd + def frogpilot_boot_functions(): def boot_thread(): @@ -21,6 +26,32 @@ def install_frogpilot(): for path in paths: path.mkdir(parents=True, exist_ok=True) + update_boot_logo(frogpilot=True) + def uninstall_frogpilot(): + update_boot_logo(stock=True) + HARDWARE.uninstall() + + +def update_boot_logo(frogpilot=False, stock=False): + boot_logo_location = Path("/usr/comma/bg.jpg") + + if frogpilot: + target_logo = Path(BASEDIR) / "frogpilot/assets/other_images/frogpilot_boot_logo.jpg" + elif stock: + target_logo = Path(BASEDIR) / "frogpilot/assets/other_images/stock_bg.jpg" + else: + print(f'Error: Must specify either "frogpilot=True" or "stock=True"') + return + + if not target_logo.is_file(): + print(f"Error: Target logo file not found at {target_logo}") + return + + if boot_logo_location.read_bytes() != target_logo.read_bytes(): + mount_options = run_cmd(["findmnt", "-n", "-o", "OPTIONS", "/"], "Successfully retrieved mount options", "Failed to retrieve mount options") + run_cmd(["sudo", "mount", "-o", "remount,rw", "/"], "Successfully remounted / as read-write", "Failed to remount /") + run_cmd(["sudo", "cp", target_logo, boot_logo_location], "Successfully replaced boot logo", "Failed to replace boot logo") + run_cmd(["sudo", "mount", "-o", f"remount,{mount_options}", "/"], "Successfully restored / mount options", "Failed to restore / mount options") diff --git a/selfdrive/assets/images/spinner_comma.png b/selfdrive/assets/images/spinner_comma.png index 16109557..9c85973d 100644 Binary files a/selfdrive/assets/images/spinner_comma.png and b/selfdrive/assets/images/spinner_comma.png differ diff --git a/selfdrive/assets/images/spinner_track.png b/selfdrive/assets/images/spinner_track.png index 931c17e8..42084f1a 100644 Binary files a/selfdrive/assets/images/spinner_track.png and b/selfdrive/assets/images/spinner_track.png differ diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index e9b91fd8..74705f93 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -395,6 +395,8 @@ def invalid_lkas_setting_alert(CP: car.CarParams, CS: car.CarState, sm: messagin # FrogPilot variables +def custom_startup_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert: + return StartupAlert(frogpilot_toggles.startup_alert_top, frogpilot_toggles.startup_alert_bottom, alert_status=FrogPilotAlertStatus.frogpilot) @@ -1030,6 +1032,9 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { # FrogPilot variables FROGPILOT_EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { + FrogPilotEventName.customStartupAlert: { + ET.PERMANENT: custom_startup_alert, + }, } diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py old mode 100755 new mode 100644 index 2221c77b..a19b1ea1 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -125,7 +125,7 @@ class SelfdriveD: self.rk = Ratekeeper(100, print_delay_threshold=None) # Determine startup event - self.startup_event = EventName.startup if build_metadata.openpilot.comma_remote and build_metadata.tested_channel else EventName.startupMaster + self.startup_event = FrogPilotEventName.customStartupAlert if HARDWARE.get_device_type() == 'mici': self.startup_event = None if not car_recognized: @@ -158,7 +158,10 @@ class SelfdriveD: # Add startup event if self.startup_event is not None: - self.events.add(self.startup_event) + if self.startup_event in (FrogPilotEventName.customStartupAlert): + self.frogpilot_events.add(self.startup_event) + else: + self.events.add(self.startup_event) self.startup_event = None # Don't add any more events if not initialized diff --git a/selfdrive/ui/qt/util.cc b/selfdrive/ui/qt/util.cc index 493c2039..e89746fb 100644 --- a/selfdrive/ui/qt/util.cc +++ b/selfdrive/ui/qt/util.cc @@ -27,7 +27,7 @@ QString getVersion() { } QString getBrand() { - return QObject::tr("openpilot"); + return QObject::tr("FrogPilot"); } QString getUserAgent() { diff --git a/selfdrive/ui/qt/widgets/toggle.cc b/selfdrive/ui/qt/widgets/toggle.cc index 82302ad5..1236d25d 100644 --- a/selfdrive/ui/qt/widgets/toggle.cc +++ b/selfdrive/ui/qt/widgets/toggle.cc @@ -75,7 +75,7 @@ void Toggle::setEnabled(bool value) { enabled = value; if (value) { circleColor.setRgb(0xfafafa); - green.setRgb(0x33ab4c); + green.setRgb(0x178644); } else { circleColor.setRgb(0x888888); green.setRgb(0x227722); diff --git a/system/ui/spinner.py b/system/ui/spinner.py index 2d5e7037..d8d63c8f 100755 --- a/system/ui/spinner.py +++ b/system/ui/spinner.py @@ -28,6 +28,7 @@ LINE_HEIGHT = 104 DARKGRAY = (55, 55, 55, 255) # FrogPilot variables +GREEN = (23, 134, 68, 242) def clamp(value, min_value, max_value): @@ -82,7 +83,7 @@ class Spinner(Widget): rl.draw_rectangle_rounded(bar, 1, 10, DARKGRAY) bar.width *= self._progress / 100.0 - rl.draw_rectangle_rounded(bar, 1, 10, rl.WHITE) + rl.draw_rectangle_rounded(bar, 1, 10, GREEN) elif self._wrapped_lines: for i, line in enumerate(self._wrapped_lines): text_size = measure_text_cached(gui_app.font(), line, FONT_SIZE)