FrogPilot features - Store user's toggles in storage

This commit is contained in:
FrogAi
2024-07-19 00:14:33 -07:00
parent a20d4b5bfd
commit 48400583e2
3 changed files with 12 additions and 1 deletions
@@ -139,6 +139,11 @@ def frogpilot_boot_functions(build_metadata, params, params_storage):
print(f"Backup failed: {e}")
def setup_frogpilot(build_metadata):
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)
remount_root = ['sudo', 'mount', '-o', 'remount,rw', '/']
run_cmd(remount_root, "File system remounted as read-write.", "Failed to remount file system.")
+1
View File
@@ -511,6 +511,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
resetTogglesBtn->setEnabled(false);
resetTogglesBtn->setValue(tr("Resetting toggles..."));
std::system("rm -rf /persist/params");
params.putBool("DoToggleReset", true);
resetTogglesBtn->setValue(tr("Reset!"));
+6 -1
View File
@@ -357,7 +357,12 @@ def manager_init() -> 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_nonblocking("DoToggleReset", False)