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