FrogPilot branding
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 760 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
@@ -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")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 565 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 79 KiB |
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
Executable → Regular
+5
-2
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@ QString getVersion() {
|
||||
}
|
||||
|
||||
QString getBrand() {
|
||||
return QObject::tr("openpilot");
|
||||
return QObject::tr("FrogPilot");
|
||||
}
|
||||
|
||||
QString getUserAgent() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user