FrogPilot setup - FrogPilot branding

This commit is contained in:
FrogAi
2024-06-07 03:19:29 -07:00
parent 44c5373b2b
commit b5c7a064f8
10 changed files with 53 additions and 5 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 69 KiB

+1 -1
View File
@@ -229,7 +229,7 @@ def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
if "REPLAY" in os.environ:
branch = "replay"
return StartupAlert("WARNING: This branch is not tested", branch, alert_status=AlertStatus.userPrompt)
return StartupAlert("Hippity hoppity this is my property", "so I do what I want 🐸", alert_status=AlertStatus.frogpilot)
def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage")
Binary file not shown.

After

Width:  |  Height:  |  Size: 778 KiB

@@ -1,4 +1,20 @@
import filecmp
import os
import shutil
import subprocess
from openpilot.common.basedir import BASEDIR
from openpilot.common.params_pyx import Params, UnknownKeyName
from openpilot.system.hardware import HARDWARE
def run_cmd(cmd, success_msg, fail_msg):
try:
subprocess.check_call(cmd)
print(success_msg)
except subprocess.CalledProcessError as e:
print(f"{fail_msg}: {e}")
except Exception as e:
print(f"Unexpected error occurred: {e}")
class FrogPilotFunctions:
@classmethod
@@ -67,3 +83,30 @@ class FrogPilotFunctions:
original_boot_logo_save_location = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
shutil.copy(original_boot_logo_location, original_boot_logo_save_location)
print("Successfully replaced original_bg.jpg with bg.jpg.")
@classmethod
def setup_frogpilot(cls):
frogpilot_boot_logo = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/frogpilot_boot_logo.png'
boot_logo_location = '/usr/comma/bg.jpg'
boot_logo_save_location = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
remount_root = ['sudo', 'mount', '-o', 'remount,rw', '/']
run_cmd(remount_root, "File system remounted as read-write.", "Failed to remount file system.")
if not os.path.exists(boot_logo_save_location):
shutil.copy(boot_logo_location, boot_logo_save_location)
print("Successfully backed up the original boot logo.")
if not filecmp.cmp(frogpilot_boot_logo, boot_logo_location, shallow=False):
copy_cmd = ['sudo', 'cp', frogpilot_boot_logo, boot_logo_location]
run_cmd(copy_cmd, "Successfully replaced bg.jpg with frogpilot_boot_logo.png.", "Failed to replace boot logo.")
@classmethod
def uninstall_frogpilot(cls):
original_boot_logo = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
boot_logo_location = '/usr/comma/bg.jpg'
copy_cmd = ['sudo', 'cp', original_boot_logo, boot_logo_location]
run_cmd(copy_cmd, "Successfully restored the original boot logo.", "Failed to restore the original boot logo.")
HARDWARE.uninstall()
+3
View File
@@ -29,6 +29,9 @@ protected:
{cereal::ControlsState::AlertStatus::NORMAL, QColor(0x15, 0x15, 0x15, 0xf1)},
{cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(0xDA, 0x6F, 0x25, 0xf1)},
{cereal::ControlsState::AlertStatus::CRITICAL, QColor(0xC9, 0x22, 0x31, 0xf1)},
// FrogPilot alert colors
{cereal::ControlsState::AlertStatus::FROGPILOT, QColor(0x17, 0x86, 0x44, 0xf1)},
};
void paintEvent(QPaintEvent*) override;
+1 -1
View File
@@ -88,7 +88,7 @@ Spinner::Spinner(QWidget *parent) : QWidget(parent) {
}
QProgressBar::chunk {
border-radius: 10px;
background-color: white;
background-color: rgba(23, 134, 68, 255);
}
)");
+1 -1
View File
@@ -26,7 +26,7 @@ QString getVersion() {
}
QString getBrand() {
return QObject::tr("openpilot");
return QObject::tr("FrogPilot");
}
QString getUserAgent() {
+1 -1
View File
@@ -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);
+3 -1
View File
@@ -181,6 +181,8 @@ def manager_thread() -> None:
def main(frogpilot_functions) -> None:
frogpilot_functions.setup_frogpilot()
manager_init(frogpilot_functions)
if os.getenv("PREPAREONLY") is not None:
return
@@ -199,7 +201,7 @@ def main(frogpilot_functions) -> None:
params = Params()
if params.get_bool("DoUninstall"):
cloudlog.warning("uninstalling")
HARDWARE.uninstall()
frogpilot_functions.uninstall_frogpilot()
elif params.get_bool("DoReboot"):
cloudlog.warning("reboot")
HARDWARE.reboot()