diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/neural_network_lateral_control.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/neural_network_lateral_control.cc
index d74e9e54e2..58e7f1c479 100644
--- a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/neural_network_lateral_control.cc
+++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/neural_network_lateral_control.cc
@@ -11,6 +11,14 @@ NeuralNetworkLateralControl::NeuralNetworkLateralControl() :
ParamControl("NeuralNetworkLateralControl", tr("Neural Network Lateral Control (NNLC)"), "", "") {
setConfirmation(true, false);
+ QObject::connect(this, &ParamControl::toggleFlipped, [=](bool state) {
+ if (state) {
+ showDescription();
+ } else {
+ hideDescription();
+ }
+ });
+
updateToggle();
}
@@ -27,7 +35,6 @@ void NeuralNetworkLateralControl::updateToggle() {
QString nnff_status_init = "⚠️ " + tr("Start the car to check car compatibility") + "";
QString nnff_not_loaded = "⚠️ " + tr("NNLC Not Loaded") + "";
QString nnff_loaded = "✅ " + tr("NNLC Loaded") + "";
- auto _car_model = QString::fromStdString(params.get("NNFFCarModel"));
auto cp_bytes = params.get("CarParamsPersistent");
auto cp_sp_bytes = params.get("CarParamsSPPersistent");
@@ -39,34 +46,37 @@ void NeuralNetworkLateralControl::updateToggle() {
cereal::CarParams::Reader CP = cmsg.getRoot();
cereal::CarParamsSP::Reader CP_SP = cmsg_sp.getRoot();
- if (CP.getSteerControlType() == cereal::CarParams::SteerControlType::ANGLE) {
- params.remove("EnforceTorqueLateral");
+ /*** NNLC ***/
+ {
+ if (CP.getSteerControlType() == cereal::CarParams::SteerControlType::ANGLE) {
+ params.remove("NeuralNetworkLateralControl");
- setDescription(nnffDescriptionBuilder(nnff_available_desc));
- setEnabled(false);
- params.remove("NNFF");
- } else if (isToggled()) {
- if (CP.getLateralTuning().which() == cereal::CarParams::LateralTuning::TORQUE) {
- QString nn_model_name = QString::fromStdString(CP_SP.getNeuralNetworkLateralControl().getModel().getName());
- QString nn_fuzzy = CP_SP.getNeuralNetworkLateralControl().getFuzzyFingerprint() ? tr("Fuzzy") : tr("Exact");
+ setDescription(nnffDescriptionBuilder(nnff_available_desc));
+ setEnabled(false);
+ } else if (isToggled()) {
+ if (CP.getLateralTuning().which() == cereal::CarParams::LateralTuning::TORQUE) {
+ QString nn_model_name = QString::fromStdString(CP_SP.getNeuralNetworkLateralControl().getModel().getName());
+ QString nn_fuzzy = CP_SP.getNeuralNetworkLateralControl().getFuzzyFingerprint() ? tr("Fuzzy") : tr("Exact");
- setDescription(nnffDescriptionBuilder(
- (nn_model_name == "")
- ? nnff_status_init
- : (nn_model_name == "mock")
- ? (nnff_not_loaded + "
" + tr(
- "Reach out to the sunnypilot team in the following channel at the sunnypilot Discord server and donate logs to get NNLC loaded for your car: ")
- + "#tuning-nnlc")
- : (nnff_loaded + " | " + tr("Match") + " = " + nn_fuzzy + " | " + _car_model + "
" +
- nnff_fuzzy_desc)));
+ setDescription(nnffDescriptionBuilder(
+ (nn_model_name == "")
+ ? nnff_status_init
+ : (nn_model_name == "MOCK")
+ ? (nnff_not_loaded + "
" + tr(
+ "Reach out to the sunnypilot team in the following channel at the sunnypilot Discord server and donate logs to get NNLC loaded for your car: ")
+ + "#tuning-nnlc")
+ : (nnff_loaded + " | " + tr("Match") + " = " + nn_fuzzy + " | " + nn_model_name + "
" +
+ nnff_fuzzy_desc)
+ ));
+ } else {
+ setDescription(nnffDescriptionBuilder(nnff_status_init));
+ }
} else {
- setDescription(nnffDescriptionBuilder(nnff_status_init));
+ setDescription(nnff_description);
}
- } else {
- setDescription(nnff_description);
}
} else {
- setDescription(nnff_description);
+ setDescription(isToggled() ? nnffDescriptionBuilder(nnff_status_init) : nnff_description);
}
}