From dd7ec95aa03551efde77bc16adabd1f0be668f55 Mon Sep 17 00:00:00 2001 From: Roberto Arellano Date: Tue, 27 Aug 2024 11:46:06 -0600 Subject: [PATCH] refactor: check sd card format --- firmware/main/modules/menus_module/menus.h | 3 ++- .../modules/settings/sd_card/sd_card_settings_module.c | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/main/modules/menus_module/menus.h b/firmware/main/modules/menus_module/menus.h index 352707d..86f5a6f 100644 --- a/firmware/main/modules/menus_module/menus.h +++ b/firmware/main/modules/menus_module/menus.h @@ -13,6 +13,7 @@ #include "file_manager_module.h" #include "open_thread_module.h" #include "ota_module.h" +#include "sd_card_settings_module.h" #include "settings_module.h" #include "stealth_mode.h" #include "web_file_browser_module.h" @@ -465,7 +466,7 @@ menu_t menus[] = { ////////////////////////////////// .menu_idx = MENU_SETTINGS_SD_CARD_FORMAT_2, .parent_idx = MENU_SETTINGS_SD_CARD_2, .last_selected_submenu = 0, - .on_enter_cb = NULL, + .on_enter_cb = sd_card_settings_verify_sd_card, .on_exit_cb = NULL, .is_visible = true}, #ifdef CONFIG_FILE_MANAGER_ENABLE diff --git a/firmware/main/modules/settings/sd_card/sd_card_settings_module.c b/firmware/main/modules/settings/sd_card/sd_card_settings_module.c index 8094719..ed91085 100644 --- a/firmware/main/modules/settings/sd_card/sd_card_settings_module.c +++ b/firmware/main/modules/settings/sd_card/sd_card_settings_module.c @@ -28,6 +28,7 @@ const char* sd_card_state_to_name[] = { sd_card_settings_state_t state = SD_CARD_SETTINGS_VERIFYING; void sd_card_settings_verify_sd_card() { + menus_module_set_app_state(true, sd_card_settings_keyboard_cb); ESP_LOGI(TAG, "Verifying SD card..."); state = SD_CARD_SETTINGS_VERIFYING; @@ -70,12 +71,10 @@ void sd_card_settings_keyboard_cb(uint8_t button_name, uint8_t button_event) { } break; case SD_CARD_SETTINGS_OK: - menus_module_set_app_state(false, NULL); - menu_screens_enter_submenu(); + menus_module_exit_app(); break; default: - menus_module_set_app_state(false, NULL); - menu_screens_exit_submenu(); + menus_module_exit_app(); break; } break;