Skip to content

Commit

Permalink
add ZMQ button
Browse files Browse the repository at this point in the history
  • Loading branch information
Comma Device committed Oct 20, 2024
1 parent 7e686bc commit 20151f1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
27 changes: 21 additions & 6 deletions selfdrive/ui/qt/offroad/developer_panel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,41 @@
DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) {
// SSH keys
addItem(new SshToggle());
addItem(new SshControl());
sshControlButton = new SshControl();
addItem(sshControlButton);

joystickDebugModeButton = new ButtonControl(tr("Joystick Debug Mode"), tr("JOYSTICK"));
addItem(joystickDebugModeButton);
connect(joystickDebugModeButton, &ButtonControl::clicked, [=]() {
params.putBool("JoystickDebugMode", true);
if (ConfirmationDialog::confirm(tr("Are you sure you want to openpilot in JoystickDebugMode?"), tr("Joystick"), this)) {
params.putBool("JoystickDebugMode", true);
}
});
addItem(joystickDebugModeButton);

LongitudinalManeuverModeButton = new ButtonControl(tr("Longitudinal Maneuver Mode"), tr("MANEUVER"));
addItem(LongitudinalManeuverModeButton);
connect(LongitudinalManeuverModeButton, &ButtonControl::clicked, [=]() {
params.putBool("LongitudinalManeuverMode", true);
if (ConfirmationDialog::confirm(tr("Are you sure you want to openpilot in LongitudinalManeuverMode?"), tr("Maneuver"), this)) {
params.putBool("LongitudinalManeuverMode", true);
}
});
addItem(LongitudinalManeuverModeButton);

ZMQButton = new ButtonControl(tr("Zero MQ Mode"), tr("ZMQ=1"));
connect(ZMQButton, &ButtonControl::clicked, [=]() {
if (ConfirmationDialog::confirm(tr("Are you sure you want to put openpilot in ZMQ mode?"), tr("ZMQ=1"), this)) {
qputenv("ZMQ", "1");
}
});
addItem(ZMQButton);

// Joystick and longitudinal maneuvers should be hidden on release branches
const bool is_release = params.getBool("IsReleaseBranch");
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<ButtonControl *>()) {
if (!(btn == sshControlButton || btn == ZMQButton)) {
btn->setVisible(!is_release);
}
btn->setEnabled(offroad);
btn->setVisible(!is_release);
}
});

Expand Down
2 changes: 2 additions & 0 deletions selfdrive/ui/qt/offroad/developer_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class DeveloperPanel : public ListWidget {

private:
Params params;
ButtonControl *sshControlButton;
ButtonControl *joystickDebugModeButton;
ButtonControl *LongitudinalManeuverModeButton;
ButtonControl *ZMQButton;
};
2 changes: 1 addition & 1 deletion selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/ui/qt/widgets/prime.h"
#include "selfdrive/ui/qt/widgets/scrollview.h"
// #include "selfdrive/ui/qt/widgets/ssh_keys.h"
#include "selfdrive/ui/qt/widgets/ssh_keys.h"
#include "selfdrive/ui/qt/offroad/developer_panel.h"

TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
Expand Down

0 comments on commit 20151f1

Please sign in to comment.