Skip to content

Commit

Permalink
ui: Transition offroad state for Device panel buttons (commaai#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin authored Jan 18, 2025
1 parent ac25574 commit 1a3f86a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
});
addItem(translateBtn);
#endif

QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<ButtonControl *>()) {
Expand All @@ -270,6 +271,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
});

#ifndef SUNNYPILOT
// power buttons
QHBoxLayout *power_layout = new QHBoxLayout();
power_layout->setSpacing(30);
Expand Down
6 changes: 6 additions & 0 deletions selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) {

addItem(device_grid_layout);

QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<PushButtonSP*>()) {
btn->setEnabled(offroad);
}
});

// offroad mode and power buttons

QHBoxLayout *power_layout = new QHBoxLayout();
Expand Down

0 comments on commit 1a3f86a

Please sign in to comment.