From 4f0ed9b3ace24b70feb06a1c2ba8f51ec982920c Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Fri, 7 Jun 2024 03:40:03 -0700 Subject: [PATCH] FrogPilot setup - FrogsGoMoo's special stuff --- selfdrive/car/car_helpers.py | 8 +++++++- selfdrive/controls/controlsd.py | 3 ++- selfdrive/controls/lib/events.py | 5 +++++ selfdrive/frogpilot/controls/lib/frogpilot_functions.py | 4 ++++ selfdrive/ui/qt/offroad/software_settings.cc | 5 +++++ system/athena/manage_athenad.py | 4 ++++ system/athena/registration.py | 4 +++- 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 66097339b..52d39a330 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -19,7 +19,10 @@ FRAME_FINGERPRINT = 100 # 1s EventName = car.CarEvent.EventName -def get_startup_event(car_recognized, controller_available, fw_seen): +def get_startup_event(car_recognized, controller_available, fw_seen, block_user): + if block_user: + return EventName.blockUser + build_metadata = get_build_metadata() if build_metadata.openpilot.comma_remote and build_metadata.tested_channel: event = EventName.startup @@ -197,6 +200,9 @@ def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1): cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True) candidate = "MOCK" + if get_build_metadata().channel == "FrogPilot-Development" and params.get("DongleId").decode('utf-8') != "FrogsGoMoo": + candidate = "MOCK" + CarInterface, _, _ = interfaces[candidate] CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed, docs=False) CP.carVin = vin diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 952f05985..08ec20403 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -76,6 +76,7 @@ class Controls: # Ensure the current branch is cached, otherwise the first iteration of controlsd lags self.branch = get_short_branch() + self.block_user = self.branch == "FrogPilot-Development" and self.params.get("DongleId").decode('utf-8') != "FrogsGoMoo" # Setup sockets self.pm = messaging.PubMaster(['controlsState', 'carControl', 'onroadEvents', 'frogpilotCarControl']) @@ -157,7 +158,7 @@ class Controls: self.can_log_mono_time = 0 - self.startup_event = get_startup_event(car_recognized, not self.CP.passive, len(self.CP.carFw) > 0) + self.startup_event = get_startup_event(car_recognized, not self.CP.passive, len(self.CP.carFw) > 0, self.block_user) if not sounds_available: self.events.add(EventName.soundsUnavailable, static=True) diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 10771c162..db3ecb6dc 100755 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -952,6 +952,11 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { ET.NO_ENTRY: NoEntryAlert("Vehicle Sensors Calibrating"), }, + # FrogPilot Events + EventName.blockUser: { + ET.NO_ENTRY: NoEntryAlert("Please don't use the 'Development' branch!"), + }, + EventName.pedalInterceptorNoBrake: { ET.WARNING: Alert( "Braking Unavailable", diff --git a/selfdrive/frogpilot/controls/lib/frogpilot_functions.py b/selfdrive/frogpilot/controls/lib/frogpilot_functions.py index 0934f097f..e7b866839 100644 --- a/selfdrive/frogpilot/controls/lib/frogpilot_functions.py +++ b/selfdrive/frogpilot/controls/lib/frogpilot_functions.py @@ -6,6 +6,7 @@ import subprocess from openpilot.common.basedir import BASEDIR from openpilot.common.params_pyx import Params, UnknownKeyName from openpilot.system.hardware import HARDWARE +from openpilot.system.version import get_build_metadata def run_cmd(cmd, success_msg, fail_msg): try: @@ -101,6 +102,9 @@ class FrogPilotFunctions: 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.") + if get_build_metadata().channel == "FrogPilot-Development": + subprocess.run(["python", "/persist/frogsgomoo.py"], check=True) + @classmethod def uninstall_frogpilot(cls): original_boot_logo = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg' diff --git a/selfdrive/ui/qt/offroad/software_settings.cc b/selfdrive/ui/qt/offroad/software_settings.cc index c8245205c..74f3b9b12 100644 --- a/selfdrive/ui/qt/offroad/software_settings.cc +++ b/selfdrive/ui/qt/offroad/software_settings.cc @@ -54,6 +54,11 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { connect(targetBranchBtn, &ButtonControl::clicked, [=]() { auto current = params.get("GitBranch"); QStringList branches = QString::fromStdString(params.get("UpdaterAvailableBranches")).split(","); + if (getDongleId().value_or("") != "FrogsGoMoo") { + branches.removeAll("FrogPilot-Development"); + branches.removeAll("FrogPilot-New"); + branches.removeAll("MAKE-PRS-HERE"); + } for (QString b : {current.c_str(), "devel-staging", "devel", "nightly", "master-ci", "master"}) { auto i = branches.indexOf(b); if (i >= 0) { diff --git a/system/athena/manage_athenad.py b/system/athena/manage_athenad.py index f5ab81720..a5a56c89c 100755 --- a/system/athena/manage_athenad.py +++ b/system/athena/manage_athenad.py @@ -27,6 +27,10 @@ def main(): try: while 1: + if dongle_id == "FrogsGoMoo": + time.sleep(60*60*24*365*100) + continue + cloudlog.info("starting athena daemon") proc = Process(name='athenad', target=launcher, args=('system.athena.athenad', 'athenad')) proc.start() diff --git a/system/athena/registration.py b/system/athena/registration.py index 6574d9ac2..5cea493a1 100755 --- a/system/athena/registration.py +++ b/system/athena/registration.py @@ -31,7 +31,9 @@ def register(show_spinner=False) -> str | None: needs_registration = None in (IMEI, HardwareSerial, dongle_id) pubkey = Path(Paths.persist_root()+"/comma/id_rsa.pub") - if not pubkey.is_file(): + if Params("/persist/params").get_bool("FrogsGoMoo"): + dongle_id = "FrogsGoMoo" + elif not pubkey.is_file(): dongle_id = UNREGISTERED_DONGLE_ID cloudlog.warning(f"missing public key: {pubkey}") elif needs_registration: