nyx: Allow SD removal without reloading Nyx

This commit is contained in:
CTCaer 2020-08-15 12:21:25 +03:00
parent db2da89f69
commit 9c2a064817

View file

@ -899,6 +899,10 @@ static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt)
case 1: case 1:
power_off(); power_off();
break; break;
case 2:
sd_end();
do_reload = false;
break;
} }
return mbox_action(btns, txt); return mbox_action(btns, txt);
@ -915,10 +919,10 @@ static void _check_sd_card_removed(void *params)
lv_obj_set_style(dark_bg, &mbox_darken); lv_obj_set_style(dark_bg, &mbox_darken);
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES); lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char * mbox_btn_map[] = { "\221Reboot (RCM)", "\221Power Off", "" }; static const char * mbox_btn_map[] = { "\221Reboot (RCM)", "\221Power Off", "\221Do not reload", "" };
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL); lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true); lv_mbox_set_recolor_text(mbox, true);
lv_obj_set_width(mbox, LV_HOR_RES * 4 / 9); lv_obj_set_width(mbox, LV_HOR_RES * 6 / 9);
lv_mbox_set_text(mbox, "\n#FF8000 SD card was removed!#\n\n#96FF00 Nyx will reload after inserting it.#\n"); lv_mbox_set_text(mbox, "\n#FF8000 SD card was removed!#\n\n#96FF00 Nyx will reload after inserting it.#\n");
lv_mbox_add_btns(mbox, mbox_btn_map, _removed_sd_action); lv_mbox_add_btns(mbox, mbox_btn_map, _removed_sd_action);