FrogPilot features - Reset toggles to default
This commit is contained in:
parent
0feeb09ced
commit
cec2a9fe1f
|
@ -498,6 +498,26 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||||
});
|
});
|
||||||
addItem(flashPandaBtn);
|
addItem(flashPandaBtn);
|
||||||
|
|
||||||
|
// Reset toggles to default
|
||||||
|
ButtonControl *resetTogglesBtn = new ButtonControl(tr("Reset Toggles To Default"), tr("RESET"), tr("Reset your toggle settings back to their default settings."));
|
||||||
|
connect(resetTogglesBtn, &ButtonControl::clicked, [=]() {
|
||||||
|
if (ConfirmationDialog::confirm(tr("Are you sure you want to completely reset all of your toggle settings?"), tr("Reset"), this)) {
|
||||||
|
std::thread([&] {
|
||||||
|
resetTogglesBtn->setEnabled(false);
|
||||||
|
resetTogglesBtn->setValue(tr("Resetting toggles..."));
|
||||||
|
|
||||||
|
params.putBool("DoToggleReset", true);
|
||||||
|
|
||||||
|
resetTogglesBtn->setValue(tr("Reset!"));
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||||
|
resetTogglesBtn->setValue(tr("Rebooting..."));
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||||
|
Hardware::reboot();
|
||||||
|
}).detach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addItem(resetTogglesBtn);
|
||||||
|
|
||||||
// Force offroad/onroad
|
// Force offroad/onroad
|
||||||
std::vector<QString> forceStartedOptions{tr("OFFROAD"), tr("ONROAD"), tr("OFF")};
|
std::vector<QString> forceStartedOptions{tr("OFFROAD"), tr("ONROAD"), tr("OFF")};
|
||||||
forceStartedBtn = new FrogPilotButtonsControl(tr("Force Started State"), tr("Force openpilot either offroad or onroad."), "", forceStartedOptions, true);
|
forceStartedBtn = new FrogPilotButtonsControl(tr("Force Started State"), tr("Force openpilot either offroad or onroad."), "", forceStartedOptions, true);
|
||||||
|
|
|
@ -356,9 +356,11 @@ def manager_init() -> None:
|
||||||
|
|
||||||
# set unset params
|
# set unset params
|
||||||
for k, v in default_params:
|
for k, v in default_params:
|
||||||
if params.get(k) is None:
|
if params.get(k) is None or params.get_bool("DoToggleReset"):
|
||||||
params.put(k, v)
|
params.put(k, v)
|
||||||
|
|
||||||
|
params.put_bool_nonblocking("DoToggleReset", False)
|
||||||
|
|
||||||
# Create folders needed for msgq
|
# Create folders needed for msgq
|
||||||
try:
|
try:
|
||||||
os.mkdir("/dev/shm")
|
os.mkdir("/dev/shm")
|
||||||
|
|
Loading…
Reference in New Issue