From 75c9db260fe9544d79fffe298ad3fe46134fc998 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 21 Mar 2025 01:02:09 -0400 Subject: [PATCH] ui: reset all sunnypilot settings (#692) * ui: reset all sunnypilot settings * Update selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com> --------- Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com> --- .../ui/sunnypilot/qt/offroad/settings/device_panel.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc index 5ca3d9032..46f388c75 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.cc @@ -21,6 +21,7 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) { {"retrainingBtn", tr("Training Guide")}, {"regulatoryBtn", tr("Regulatory")}, {"translateBtn", tr("Language")}, + {"resetParams", tr("Reset Settings")}, }; int row = 0, col = 0; @@ -66,6 +67,15 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) { } }); + connect(buttons["resetParams"], &PushButtonSP::clicked, [=]() { + if (ConfirmationDialog::confirm(tr("Are you sure you want to reset all sunnypilot settings to default ? This cannot be undone."), tr("Reset"), this)) { + int rm = std::system("sudo rm -rf /data/params/d/*"); + if (rm == 0) { + Hardware::reboot(); + } + } + }); + addItem(device_grid_layout); // offroad mode and power buttons