mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
FrogPilot Server Toggle
- Use richtext for FrogPilotConfirmationDialog::toggle
This commit is contained in:
@@ -116,6 +116,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"DisengageOnAccelerator", PERSISTENT | FROGPILOT_STORAGE},
|
||||
{"DmModelInitialized", CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"DongleId", PERSISTENT},
|
||||
{"DongleIdPrev", PERSISTENT | FROGPILOT_STORAGE},
|
||||
{"DoReboot", CLEAR_ON_MANAGER_START},
|
||||
{"DoShutdown", CLEAR_ON_MANAGER_START},
|
||||
{"DoUninstall", CLEAR_ON_MANAGER_START},
|
||||
@@ -331,6 +332,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"ForceStandstill", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
|
||||
{"ForceStops", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
|
||||
{"FPSCounter", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
|
||||
{"FrogId", PERSISTENT | FROGPILOT_STORAGE},
|
||||
{"FrogPilotDrives", PERSISTENT | FROGPILOT_TRACKING},
|
||||
{"FrogPilotKilometers", PERSISTENT | FROGPILOT_TRACKING},
|
||||
{"FrogPilotMinutes", PERSISTENT | FROGPILOT_TRACKING},
|
||||
@@ -547,6 +549,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"Updated", PERSISTENT},
|
||||
{"UpdateTheme", PERSISTENT},
|
||||
{"UpdateWheelImage", PERSISTENT},
|
||||
{"UseFrogServer", PERSISTENT | FROGPILOT_STORAGE},
|
||||
{"UseSI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
|
||||
{"UseStockColors", CLEAR_ON_MANAGER_START},
|
||||
{"UseVienna", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
|
||||
|
||||
@@ -31,6 +31,28 @@ function agnos_init {
|
||||
fi
|
||||
}
|
||||
|
||||
function set_dongle_id {
|
||||
PARAMS=/data/params/d
|
||||
if [ -f $PARAMS/UseFrogServer ] && [ -f $PARAMS/DongleId ] && [ -f $PARAMS/FrogId ]; then # All params created
|
||||
if [ "$(cat $PARAMS/UseFrogServer)" == "1" ]; then
|
||||
echo -e "\033[0;36mUsing FrogServer\033[0m"
|
||||
export API_HOST=https://api.springerelectronics.com
|
||||
export ATHENA_HOST=wss://athena.springerelectronics.com
|
||||
|
||||
if [ "$(cat $PARAMS/DongleId)" != "$(cat $PARAMS/FrogId)" ]; then # And they are not equal (FrogId="") which means the device never registered with FrogServer
|
||||
echo "$(cat $PARAMS/DongleId)" > $PARAMS/DongleIdOld # Backup old dongle
|
||||
if [ "$(cat $PARAMS/FrogId)" != "" ]; then # If device previously registered with FrogServer
|
||||
echo "$(cat $PARAMS/FrogId)" > $PARAMS/DongleId # Put back Frog dongle
|
||||
else
|
||||
rm $PARAMS/DongleId # Trigger registration with frog server
|
||||
fi
|
||||
fi
|
||||
elif [ -f $PARAMS/DongleIdOld ]; then # Go back to comma server
|
||||
echo "$(cat $PARAMS/DongleIdOld)" > $PARAMS/DongleId # Put back Comma dongle
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function launch {
|
||||
# Remove orphaned git lock if it exists on boot
|
||||
[ -f "$DIR/.git/index.lock" ] && rm -f $DIR/.git/index.lock
|
||||
@@ -86,6 +108,7 @@ function launch {
|
||||
if [ ! -f $DIR/prebuilt ]; then
|
||||
./build.py
|
||||
fi
|
||||
set_dongle_id
|
||||
./manager.py
|
||||
|
||||
# if broken, keep on screen error
|
||||
|
||||
@@ -47,7 +47,8 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
||||
{"DeviceManagement", tr("Device Management"), tr("Tweak your device's behaviors to your personal preferences."), "../frogpilot/assets/toggle_icons/icon_device.png"},
|
||||
{"DeviceShutdown", tr("Device Shutdown Timer"), tr("Configure how quickly the device shuts down after going offroad."), ""},
|
||||
{"NoLogging", tr("Disable Logging"), tr("Turn off all data tracking to enhance privacy or reduce thermal load."), ""},
|
||||
{"NoUploads", tr("Disable Uploads"), tr("Turn off all data uploads to comma's servers."), ""},
|
||||
{"NoUploads", tr("Disable Uploads"), tr("Turn off all data uploads to servers."), ""},
|
||||
{"UseFrogServer", tr("Switch to FrogPilot Server"), tr("Use the Frogpilot connect instead of Comma connect"), ""},
|
||||
{"IncreaseThermalLimits", tr("Increase Thermal Safety Limit"), tr("Allow the device to run at a temperature above comma's recommended thermal limits."), ""},
|
||||
{"LowVoltageShutdown", tr("Low Voltage Shutdown Threshold"), tr("Automatically shut the device down when your battery reaches a specific voltage level to prevent killing your battery."), ""},
|
||||
{"OfflineMode", tr("Offline Mode"), tr("Allow the device to be offline indefinitely."), ""},
|
||||
@@ -1140,6 +1141,33 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<ToggleControl*>(toggles["UseFrogServer"]), &ToggleControl::toggleFlipped, [this](bool state) {
|
||||
const QString enable_promt_text = tr("By keeping this toggle enabled, you agree to the following: "
|
||||
"We collect, use, and share information from and about you and your vehicle in connection with OpenPilot or variations thereof. "
|
||||
"This information may be accessed by third parties without additional notice or consent, for purposes including, but not limited to, "
|
||||
"providing OpenPilot services, data collection, software updates, safety and cybersecurity measures, and the suspension or removal of your account. "
|
||||
"Further details are outlined in our Privacy Policy (available at https://frogpilot.wiki.gg/wiki/privacy).");
|
||||
if (state) {
|
||||
if (ConfirmationDialog(enable_promt_text, tr("I agree"), tr("I do not agree"), true, this).exec()) {
|
||||
if (ConfirmationDialog(tr("Make sure you are connected to the internet before rebooting!"), tr("Reboot now"), tr("Reboot later"), false, this).exec()) {
|
||||
Hardware::reboot();
|
||||
}
|
||||
} else {
|
||||
params.putBool("UseFrogServer", false);
|
||||
}
|
||||
} else {
|
||||
if (ConfirmationDialog(tr("Are you sure you want to connect to commas servers?"), tr("Yes and reboot"), tr("Use FrogPilot server"), false, this).exec()) {
|
||||
if (ConfirmationDialog(tr("Do you want to clear all your driving logs before switching?"), tr("Delete and reboot"), tr("No, keep data"), false, this).exec()) {
|
||||
std::system("rm -rf /data/media/0/realdata");
|
||||
util::sleep_for(5000);
|
||||
}
|
||||
Hardware::reboot();
|
||||
} else {
|
||||
params.putBool("UseFrogServer", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
std::set<QString> rebootKeys = {"AlwaysOnLateral", "NNFF", "NNFFLite"};
|
||||
for (const QString &key : rebootKeys) {
|
||||
QObject::connect(static_cast<ToggleControl*>(toggles[key.toStdString().c_str()]), &ToggleControl::toggleFlipped, [this, key](bool state) {
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
std::set<QString> aolKeys = {"AlwaysOnLateralLKAS", "AlwaysOnLateralMain", "HideAOLStatusBar", "PauseAOLOnBrake"};
|
||||
std::set<QString> conditionalExperimentalKeys = {"CESpeed", "CESpeedLead", "CECurves", "CELead", "CEModelStopTime", "CENavigation", "CESignal", "HideCEMStatusBar"};
|
||||
std::set<QString> customdrivingPersonalityKeys = {"AggressivePersonalityProfile", "RelaxedPersonalityProfile", "StandardPersonalityProfile", "TrafficPersonalityProfile"};
|
||||
std::set<QString> deviceManagementKeys = {"DeviceShutdown", "IncreaseThermalLimits", "LowVoltageShutdown", "NoLogging", "NoUploads", "OfflineMode"};
|
||||
std::set<QString> deviceManagementKeys = {"DeviceShutdown", "IncreaseThermalLimits", "LowVoltageShutdown", "NoLogging", "NoUploads", "UseFrogServer", "OfflineMode"};
|
||||
std::set<QString> drivingPersonalityKeys = {"CustomPersonalities", "OnroadDistanceButton", "OnroadDistanceButtonButtons", "DownloadStatusLabel"};
|
||||
std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaTap"};
|
||||
std::set<QString> laneChangeKeys = {"LaneChangeTime", "LaneDetectionWidth", "MinimumLaneChangeSpeed", "NudgelessLaneChange", "OneLaneChange"};
|
||||
|
||||
@@ -37,6 +37,9 @@ void PairingQRWidget::hideEvent(QHideEvent *event) {
|
||||
void PairingQRWidget::refresh() {
|
||||
QString pairToken = CommaApi::create_jwt({{"pair", true}});
|
||||
QString qrString = "https://connect.comma.ai/?pair=" + pairToken;
|
||||
if (getenv("API_HOST") != nullptr) {
|
||||
qrString = "https://portal.springerelectronics.com/?pair=" + pairToken;
|
||||
}
|
||||
this->updateQrCode(qrString);
|
||||
update();
|
||||
}
|
||||
|
||||
Regular → Executable
+2
@@ -95,6 +95,8 @@ def register(show_spinner=False) -> str | None:
|
||||
|
||||
if dongle_id:
|
||||
params.put("DongleId", dongle_id)
|
||||
if params.get_bool("UseFrogServer"):
|
||||
params.put("FrogId", dongle_id)
|
||||
set_offroad_alert("Offroad_UnofficialHardware", (dongle_id == UNREGISTERED_DONGLE_ID) and not PC)
|
||||
return dongle_id
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ def manager_init() -> None:
|
||||
("ForceStandstill", "0"),
|
||||
("ForceStops", "0"),
|
||||
("FPSCounter", "1"),
|
||||
("FrogId", ""),
|
||||
("FrogsGoMooTune", "1"),
|
||||
("FullMap", "0"),
|
||||
("GasRegenCmd", "1"),
|
||||
@@ -349,6 +350,7 @@ def manager_init() -> None:
|
||||
("TurnDesires", "0"),
|
||||
("UnlimitedLength", "1"),
|
||||
("UnlockDoors", "1"),
|
||||
("UseFrogServer", "0"),
|
||||
("UseSI", "1"),
|
||||
("UseVienna", "0"),
|
||||
("VisionTurnControl", "1"),
|
||||
|
||||
Reference in New Issue
Block a user