1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 18:06:40 +00:00

nyx: Throw a warning if SD Card in 1 bit mode

This commit is contained in:
CTCaer 2020-04-30 01:05:22 +03:00
parent ce97b97c8d
commit 96654d9620
4 changed files with 32 additions and 3 deletions

View file

@ -25,7 +25,7 @@
static bool sd_mounted = false;
static u32 sd_mode = SD_UHS_SDR82;
u32 sd_mode_get()
u32 sd_get_mode()
{
return sd_mode;
}

View file

@ -34,7 +34,7 @@ sdmmc_t sd_sdmmc;
sdmmc_storage_t sd_storage;
FATFS sd_fs;
u32 sd_mode_get();
u32 sd_get_mode();
int sd_init_retry(bool power_cycle);
bool sd_initialize(bool power_cycle);
bool sd_mount();

View file

@ -367,6 +367,28 @@ lv_res_t mbox_action(lv_obj_t *btns, const char *txt)
return LV_RES_INV;
}
static void nyx_sd_card_issues(void *param)
{
lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_style(dark_bg, &mbox_darken);
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char * mbox_btn_map[] = { "\211", "\222OK", "\211", "" };
lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
lv_mbox_set_text(mbox,
"#FF8000 SD Card Issues Check#\n\n"
"#FFDD00 Your SD Card is initialized in 1-bit mode!#\n"
"#FFDD00 This might mean detached or broken connector!#\n\n"
"You might want to check\n#C7EA46 Console Info# -> #C7EA46 SD Card#");
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
}
void nyx_window_toggle_buttons(lv_obj_t *win, bool disable)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
@ -1647,6 +1669,13 @@ void nyx_load_and_run()
// Create main menu
_nyx_main_menu(th);
// Check if sd card issues.
if (sd_get_mode() == SD_1BIT_HS25)
{
lv_task_t *task_run_sd_errors = lv_task_create(nyx_sd_card_issues, LV_TASK_ONESHOT, LV_TASK_PRIO_LOWEST, NULL);
lv_task_once(task_run_sd_errors);
}
while (true)
lv_task_handler();
}

View file

@ -33,7 +33,7 @@ bool sd_get_card_removed()
return false;
}
u32 sd_mode_get()
u32 sd_get_mode()
{
return sd_mode;
}