mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-31 21:23:49 +08:00
FrogPilot features - Store user's toggles in storage
This commit is contained in:
@@ -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.")
|
||||
|
||||
|
||||
@@ -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!"));
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user