You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
2.1 KiB
49 lines
2.1 KiB
#include <QDebug>
|
|
|
|
#include "selfdrive/ui/qt/offroad/developer_panel.h"
|
|
#include "selfdrive/ui/qt/widgets/ssh_keys.h"
|
|
#include "selfdrive/ui/qt/widgets/controls.h"
|
|
|
|
DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) {
|
|
// SSH keys
|
|
addItem(new SshToggle());
|
|
addItem(new SshControl());
|
|
|
|
joystickToggle = new ParamControl("JoystickDebugMode", tr("Joystick Debug Mode"), "", "");
|
|
QObject::connect(joystickToggle, &ParamControl::toggleFlipped, [=](bool state) {
|
|
params.putBool("LongitudinalManeuverMode", false);
|
|
longManeuverToggle->refresh();
|
|
});
|
|
addItem(joystickToggle);
|
|
|
|
longManeuverToggle = new ParamControl("LongitudinalManeuverMode", tr("Longitudinal Maneuver Mode"), "", "");
|
|
QObject::connect(longManeuverToggle, &ParamControl::toggleFlipped, [=](bool state) {
|
|
params.putBool("JoystickDebugMode", false);
|
|
joystickToggle->refresh();
|
|
});
|
|
addItem(longManeuverToggle);
|
|
|
|
alphaLongToggle = new ParamControl("ExperimentalLongitudinalEnabled", tr("openpilot Longitudinal Control (Alpha)"),
|
|
QString("<b>%1</b><br><br>%2")
|
|
.arg(tr("WARNING: openpilot longitudinal control is in alpha for this car and will disable Automatic Emergency Braking (AEB)."))
|
|
.arg(tr("On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. "
|
|
"Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when enabling openpilot longitudinal control alpha.")),
|
|
"../assets/offroad/icon_speed_limit.png"
|
|
);
|
|
addItem(alphaLongToggle);
|
|
alphaLongToggle->setConfirmation(true, false);
|
|
|
|
// Joystick and longitudinal maneuvers should be hidden on release branches
|
|
// also the toggles should be not available to change in onroad state
|
|
// const bool is_release = params.getBool("IsReleaseBranch");
|
|
const bool is_release = true;
|
|
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
|
|
for (auto btn : findChildren<ParamControl *>()) {
|
|
if (btn != alphaLongToggle) {
|
|
btn->setVisible(!is_release);
|
|
btn->setEnabled(offroad);
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|