mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-17 23:32:07 +08:00
Block users from using development branches
This commit is contained in:
@@ -1040,6 +1040,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
|
||||
# FrogPilot variables
|
||||
FROGPILOT_EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
FrogPilotEventName.blockUser: {
|
||||
ET.PERMANENT: Alert(
|
||||
"Don't use the 'Development' branch!",
|
||||
"Forcing you into 'Dashcam Mode' for your safety...",
|
||||
AlertStatus.critical, AlertSize.mid,
|
||||
Priority.HIGHEST, VisualAlert.none, AudibleAlert.warningImmediate, 1.),
|
||||
},
|
||||
|
||||
FrogPilotEventName.customStartupAlert: {
|
||||
ET.PERMANENT: custom_startup_alert,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ import time
|
||||
import threading
|
||||
|
||||
import cereal.messaging as messaging
|
||||
import openpilot.system.sentry as sentry
|
||||
|
||||
from cereal import car, custom, log
|
||||
from msgq.visionipc import VisionIpcClient, VisionStreamType
|
||||
@@ -158,6 +159,10 @@ class SelfdriveD:
|
||||
|
||||
self.FPCP = messaging.log_from_bytes(self.params.get("FrogPilotCarParams", block=True), custom.FrogPilotCarParams)
|
||||
|
||||
if self.frogpilot_toggles.block_user:
|
||||
self.startup_event = FrogPilotEventName.blockUser
|
||||
sentry.capture_block()
|
||||
|
||||
def update_events(self, CS):
|
||||
"""Compute onroadEvents from carState"""
|
||||
|
||||
@@ -174,7 +179,7 @@ class SelfdriveD:
|
||||
|
||||
# Add startup event
|
||||
if self.startup_event is not None:
|
||||
if self.startup_event in (FrogPilotEventName.customStartupAlert):
|
||||
if self.startup_event in (FrogPilotEventName.blockUser, FrogPilotEventName.customStartupAlert):
|
||||
self.frogpilot_events.add(self.startup_event)
|
||||
else:
|
||||
self.events.add(self.startup_event)
|
||||
|
||||
@@ -32,7 +32,7 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
// automatic updates toggle
|
||||
ParamControl *automaticUpdatesToggle = new ParamControl("AutomaticUpdates", tr("Automatically Update FrogPilot"),
|
||||
tr("Automatically update FrogPilot when the vehicle is parked with an active internet connection."), "");
|
||||
automaticUpdatesToggle->setVisible(params.getBool("IsReleaseBranch"));
|
||||
automaticUpdatesToggle->setVisible(params.getBool("IsReleaseBranch") || isFrogsGoMoo());
|
||||
addItem(automaticUpdatesToggle);
|
||||
|
||||
// download update btn
|
||||
@@ -61,6 +61,15 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
connect(targetBranchBtn, &ButtonControl::clicked, [=]() {
|
||||
auto current = params.get("GitBranch");
|
||||
QStringList branches = QString::fromStdString(params.get("UpdaterAvailableBranches")).split(",");
|
||||
if (!isFrogsGoMoo()) {
|
||||
for (int i = branches.size() - 1; i >= 0; --i) {
|
||||
if (branches[i].startsWith("FrogPilot-Development", Qt::CaseInsensitive)) {
|
||||
branches.removeAt(i);
|
||||
}
|
||||
}
|
||||
branches.removeAll("FrogPilot-Vetting");
|
||||
branches.removeAll("MAKE-PRS-HERE");
|
||||
}
|
||||
for (QString b : {current.c_str(), "devel-staging", "devel", "nightly", "nightly-dev", "master"}) {
|
||||
auto i = branches.indexOf(b);
|
||||
if (i >= 0) {
|
||||
@@ -128,7 +137,7 @@ void SoftwarePanel::updateLabels() {
|
||||
FrogPilotUIState &fs = *frogpilotUIState();
|
||||
FrogPilotUIScene &frogpilot_scene = fs.frogpilot_scene;
|
||||
|
||||
bool parked = frogpilot_scene.parked;
|
||||
bool parked = frogpilot_scene.parked || isFrogsGoMoo();
|
||||
|
||||
// add these back in case the files got removed
|
||||
fs_watch->addParam("LastUpdateTime");
|
||||
|
||||
Reference in New Issue
Block a user