nyx: fix first time config save unmounting

SD card should not get unmounted on the first boot without hekate_ipl.ini.
Move sd card mounting management outside of it.
This commit is contained in:
CTCaer 2023-07-28 03:32:33 +03:00
parent b142ca0f33
commit f35c5b0596
2 changed files with 6 additions and 5 deletions

View file

@ -64,9 +64,6 @@ void set_nyx_default_configuration()
int create_config_entry() int create_config_entry()
{ {
if (!sd_mount())
return 1;
char lbuf[64]; char lbuf[64];
FIL fp; FIL fp;
bool mainIniFound = false; bool mainIniFound = false;
@ -184,7 +181,6 @@ int create_config_entry()
} }
f_close(&fp); f_close(&fp);
sd_unmount();
return 0; return 0;
} }

View file

@ -2073,7 +2073,10 @@ static lv_res_t _save_options_action(lv_obj_t *btn)
lv_obj_t * mbox = lv_mbox_create(lv_scr_act(), NULL); lv_obj_t * mbox = lv_mbox_create(lv_scr_act(), NULL);
lv_mbox_set_recolor_text(mbox, true); lv_mbox_set_recolor_text(mbox, true);
int res = !create_config_entry(); int res = 0;
if (sd_mount())
res = create_config_entry();
if (res) if (res)
lv_mbox_set_text(mbox, "#FF8000 hekate Configuration#\n\n#96FF00 The configuration was saved to sd card!#"); lv_mbox_set_text(mbox, "#FF8000 hekate Configuration#\n\n#96FF00 The configuration was saved to sd card!#");
@ -2084,6 +2087,8 @@ static lv_res_t _save_options_action(lv_obj_t *btn)
nyx_options_clear_ini_changes_made(); nyx_options_clear_ini_changes_made();
sd_unmount();
return LV_RES_OK; return LV_RES_OK;
} }