From 1521f591070ed98ca614e10e6b5ab4c24605387e Mon Sep 17 00:00:00 2001 From: xiehongyan Date: Thu, 11 Jan 2024 16:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=A2=84=E8=A7=88=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=95=BF=E6=8C=89=E4=B8=8B=E9=94=AE=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=8A=9F=E8=83=BD,=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0emmc=E6=BB=A1=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIFlowPhoto/UIFlowPhotoEventCallback.c | 118 +++++++++++------- 1 file changed, 74 insertions(+), 44 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c index a86534556..5ea9a971d 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c @@ -74,6 +74,7 @@ static BOOL g_SysStrg_Chg = true; //#NT#2023/11/21#Eric - end static int cnt = 0; +static int first_check_storage = 1; #define FREE_SIZE_MB 30 @@ -694,49 +695,51 @@ static void update_storage_sd_card(void) { const int storageType = get_storage_type(); const UINT32 cardStatus = System_GetState(SYS_STATE_CARD); - - if (MMC_DEV_SD == storageType && cardStatus == CARD_REMOVED) + UINT64 diskSize = 0; + UINT64 diskFree = 0; + if (MMC_DEV_NO == storageType) { return; } - // if (cardStatus != CARD_REMOVED) + else if (MMC_DEV_SD == storageType) { - - if (UIStorageCheck(STORAGE_CHECK_ERROR, NULL) == TRUE) + if (cardStatus == CARD_REMOVED) { - // if(UIStorageCheck_DCIMWritable() == FALSE){ - // set_warning_label_text(label_6_scr_uiflowphoto); - // lv_label_set_text(label_6_scr_uiflowphoto, "SD Card Error"); - // } - } - else if (UIStorageCheck(STORAGE_CHECK_FULL, NULL) == TRUE) - { - //set_warning_label_text(label_6_scr_uiflowphoto); - //lv_label_set_text(label_6_scr_uiflowphoto, "SD Card FULL"); + return; } else { - UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum); - set_normal_label_text(label_6_scr_uiflowphoto); - lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum)); - lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum)); - set_normal_label_text(label_6_scr_uiflowphoto); - lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum)); - set_normal_label_text(label_6_scr_uiflowphoto); + diskSize = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE); + diskFree = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE); + if (0 == diskSize) + { + return;/*sd card error*/ + } + if (diskFree < (FREE_SIZE_MB*1024*1024)) + { + return;/*sd card full*/ + } + } + } + else if (MMC_DEV_EMMC == storageType) + { + diskSize = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE); + diskFree = FileSys_GetDiskInfoEx('B', FST_INFO_FREE_SPACE); + if (0 == diskSize) + { + return;/*emmc error*/ + } + if (diskFree < (FREE_SIZE_MB*1024*1024)) + { + return;/*emmc full*/ } } - // else - // { - // set_warning_label_text(label_6_scr_uiflowphoto); - // lv_label_set_text(label_6_scr_uiflowphoto, "No SD Card"); - // } - // else - // { - // set_warning_label_text(label_6_scr_uiflowphoto); - // lv_label_set_text(label_6_scr_uiflowphoto, "No SD Card"); - // } + UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum); + set_normal_label_text(label_6_scr_uiflowphoto); + lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum)); } + unsigned int check_sd_size(UINT64 diskSize) { // printf("========================================= %llu\n", diskSize); @@ -862,11 +865,23 @@ static void update_emmc_status(lv_obj_t* obj) static void update_storage_message(void) { + if (1 == first_check_storage) + { + first_check_storage = 0; + } + else + { + if (0 == cnt) + { + cnt = 2; + } + } + if (g_SysStrg_Chg) { set_normal_label_text(label_6_scr_uiflowphoto); - - if(cnt<3){ + if (cnt < 3){ + printf("[================%d================]\n", cnt); cnt++; set_normal_label_text(label_6_scr_uiflowphoto); //lv_label_set_text(label_6_scr_uiflowphoto, ""); @@ -875,9 +890,12 @@ static void update_storage_message(void) { g_SysStrg_Chg = false; cnt = 0; + first_check_storage = 0; } return; } + + if (MMC_DEV_SD == get_storage_type()) { //printf("[%s]SD storage\n", __FUNCTION__); @@ -888,15 +906,28 @@ static void update_storage_message(void) else if (MMC_DEV_EMMC == get_storage_type()) { //printf("[%s]EMMC storage\n", __FUNCTION__); - update_emmc_status(image_8_scr_uiflowphoto); update_sd_card_status(image_9_scr_uiflowphoto); + update_emmc_status(image_8_scr_uiflowphoto); update_storage_sd_card(); } else { //printf("[%s]NO EMMC NO SD\n", __FUNCTION__); - lv_plugin_img_set_src(image_8_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS); + const UINT32 cardStatus = System_GetState(SYS_STATE_CARD); + UINT64 diskSize = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE); + if(0 == diskSize) + { + lv_plugin_img_set_src(image_8_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS); + set_warning_label_text(label_6_scr_uiflowphoto); + lv_label_set_text(label_6_scr_uiflowphoto, "EMMC Error"); + } + else + { + lv_plugin_img_set_src(image_8_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_EMMC_FULL); + set_warning_label_text(label_6_scr_uiflowphoto); + lv_label_set_text(label_6_scr_uiflowphoto, "EMMC FULL"); + } if (CARD_REMOVED == cardStatus) { lv_plugin_img_set_src(image_9_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_NO); @@ -905,8 +936,7 @@ static void update_storage_message(void) { lv_plugin_img_set_src(image_9_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_DIS); } - set_warning_label_text(label_6_scr_uiflowphoto); - lv_label_set_text(label_6_scr_uiflowphoto, "EMMC Error"); + } @@ -2023,7 +2053,7 @@ static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m case NVTEVT_STORAGE_CHANGE: //#NT#2023/11/21#Eric - begin //#NT#Support IVOT_N12144_CO-148_1120_4 - //g_SysStrg_Chg = true; + g_SysStrg_Chg = true; //#NT#2023/11/21#Eric - end UIFlowPhoto_OnStorageChange(obj, msg); break; @@ -2241,12 +2271,12 @@ void UIFlowPhtot_KeyLongPress(lv_obj_t* obj, uint32_t key) { // g_preview_info_ishidden = false; KeyDownPressingTimeMs += LONG_PRESS_INTERVAL; - if (5 * 1000 <= KeyDownPressingTimeMs) - { - sf_send_message_to_create_qrcode(); - sf_save_camera_info(); - KeyDownPressingTimeMs = 0; - } + // if (5 * 1000 <= KeyDownPressingTimeMs) + // { + // sf_send_message_to_create_qrcode(); + // sf_save_camera_info(); + // KeyDownPressingTimeMs = 0; + // } break; } default: