FrogPilot features - Store user's toggles in storage

This commit is contained in:
FrogAi
2024-05-18 22:39:53 -07:00
parent 7f8b1505b3
commit bbbe20ebdd
3 changed files with 12 additions and 1 deletions
@@ -149,6 +149,11 @@ class FrogPilotFunctions:
@classmethod
def setup_frogpilot(cls):
remount_persist = ['sudo', 'mount', '-o', 'remount,rw', '/persist']
run_cmd(remount_persist, "Successfully remounted /persist as read-write.", "Failed to remount /persist.")
os.makedirs("/persist/params", exist_ok=True)
frogpilot_boot_logo = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/frogpilot_boot_logo.png'
boot_logo_location = '/usr/comma/bg.jpg'
boot_logo_save_location = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
+1
View File
@@ -459,6 +459,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
if (ConfirmationDialog::confirm(tr("Are you sure you want to completely reset all of your toggle settings?"), tr("Reset"), this)) {
std::thread([&] {
resetTogglesBtn->setValue(tr("Resetting toggles..."));
std::system("rm -rf /persist/params");
params.putBool("DoToggleReset", true);
std::this_thread::sleep_for(std::chrono::seconds(2));
resetTogglesBtn->setValue(tr("Reset!"));
+6 -1
View File
@@ -321,7 +321,12 @@ def manager_init(frogpilot_functions) -> None:
# set unset params
for k, v in default_params:
if params.get(k) is None or params.get_bool("DoToggleReset"):
params.put(k, v)
if params_storage.get(k) is None:
params.put(k, v)
else:
params.put(k, params_storage.get(k))
else:
params_storage.put(k, params.get(k))
params.put_bool("DoToggleReset", False)