Disable openpilot longitudinal

This commit is contained in:
James
2025-12-01 12:00:00 -07:00
parent d2da2e8a07
commit b7db0c72ec
5 changed files with 36 additions and 3 deletions
+2
View File
@@ -268,8 +268,10 @@ class FrogPilotVariables:
else:
FPCP = interfaces[MOCK.MOCK].get_frogpilot_params(MOCK.MOCK, gen_empty_fingerprint(), [], CP, toggle)
alpha_longitudinal = CP.alphaLongitudinalAvailable
toggle.car_make = CP.brand
toggle.car_model = CP.carFingerprint
toggle.disable_openpilot_long = self.get_value("DisableOpenpilotLongitudinal", condition=not alpha_longitudinal)
friction = CP.lateralTuning.torque.friction
has_bsm = CP.enableBsm
toggle.has_cc_long = toggle.car_make == "gm" and bool(CP.flags & GMFlags.CC_LONG.value)
@@ -12,6 +12,26 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(FrogPilotSettingsWindow *parent,
vehiclesLayout->addWidget(vehiclesPanel);
disableOpenpilotLong = new ParamControl("DisableOpenpilotLongitudinal", tr("Disable openpilot Longitudinal Control"), tr("<b>Disable openpilot longitudinal</b> and use the car's stock ACC instead."), "");
QObject::connect(disableOpenpilotLong, &ToggleControl::toggleFlipped, [parent, this](bool state) {
if (state) {
if (FrogPilotConfirmationDialog::yesorno(tr("Are you sure you want to completely disable openpilot longitudinal control?"), this)) {
if (started) {
if (FrogPilotConfirmationDialog::toggleReboot(this)) {
Hardware::reboot();
}
}
} else {
params.putBool("DisableOpenpilotLongitudinal", false);
disableOpenpilotLong->refresh();
}
}
parent->updateVariables();
updateToggles();
});
settingsList->addItem(disableOpenpilotLong);
FrogPilotListWidget *gmList = new FrogPilotListWidget(this);
FrogPilotListWidget *hkgList = new FrogPilotListWidget(this);
FrogPilotListWidget *subaruList = new FrogPilotListWidget(this);
@@ -178,6 +198,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(FrogPilotSettingsWindow *parent,
QObject::connect(parent, &FrogPilotSettingsWindow::closeSubPanel, [vehiclesLayout, vehiclesPanel, this] {
if (forceOpenDescriptions) {
openDescriptions(forceOpenDescriptions, toggles);
disableOpenpilotLong->showDescription();
}
vehiclesLayout->setCurrentWidget(vehiclesPanel);
});
@@ -186,6 +207,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(FrogPilotSettingsWindow *parent,
void FrogPilotVehiclesPanel::showEvent(QShowEvent *event) {
if (forceOpenDescriptions) {
disableOpenpilotLong->showDescription();
}
QStringList detected;
@@ -275,6 +297,8 @@ void FrogPilotVehiclesPanel::updateToggles() {
}
}
disableOpenpilotLong->setVisible((parent->hasOpenpilotLongitudinal || parent->openpilotLongitudinalControlDisabled) && !parent->hasAlphaLongitudinal && parent->tuningLevel >= parent->frogpilotToggleLevels["DisableOpenpilotLongitudinal"].toBool());
openDescriptions(forceOpenDescriptions, toggles);
update();
@@ -34,5 +34,7 @@ private:
FrogPilotSettingsWindow *parent;
ParamControl *disableOpenpilotLong;
Params params;
};
+4
View File
@@ -175,6 +175,10 @@ def get_car(can_recv: CanRecvCallable, can_send: CanSendCallable, set_obd_multip
# FrogPilot variables
FPCP: FrogPilotCarParams = CarInterface.get_frogpilot_params(candidate, fingerprints, car_fw, CP, frogpilot_toggles)
if not CP.alphaLongitudinalAvailable and frogpilot_toggles.disable_openpilot_long:
CP.openpilotLongitudinalControl = False
FPCP.openpilotLongitudinalControlDisabled = True
return interfaces[CP.carFingerprint](CP, FPCP)
+4 -3
View File
@@ -198,9 +198,10 @@ QPixmap bootstrapPixmap(const QString &id) {
bool hasLongitudinalControl(const cereal::CarParams::Reader &car_params) {
// Using the experimental longitudinal toggle, returns whether longitudinal control
// will be active without needing a restart of openpilot
return car_params.getAlphaLongitudinalAvailable()
? Params().getBool("AlphaLongitudinalEnabled")
: car_params.getOpenpilotLongitudinalControl();
Params params = Params();
return (car_params.getAlphaLongitudinalAvailable()
? params.getBool("AlphaLongitudinalEnabled")
: car_params.getOpenpilotLongitudinalControl()) && !params.getBool("DisableOpenpilotLongitudinal");
}
// ParamWatcher