sd卡error和emmcerror判定, mcu升级界面判定
This commit is contained in:
parent
1521f59107
commit
86805e14a4
|
@ -691,54 +691,6 @@ int get_storage_type(void)
|
|||
}
|
||||
return mmc_dev->dev_type;
|
||||
}
|
||||
static void update_storage_sd_card(void)
|
||||
{
|
||||
const int storageType = get_storage_type();
|
||||
const UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
|
||||
UINT64 diskSize = 0;
|
||||
UINT64 diskFree = 0;
|
||||
if (MMC_DEV_NO == storageType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (MMC_DEV_SD == storageType)
|
||||
{
|
||||
if (cardStatus == CARD_REMOVED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
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*/
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -779,8 +731,20 @@ unsigned int check_sd_size(UINT64 diskSize)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
static void update_sd_card_status(lv_obj_t* obj)
|
||||
static void update_sd_emmc_status(void)
|
||||
{
|
||||
UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
|
||||
|
||||
UINT64 diskSizeSd = 0;
|
||||
UINT64 diskFreeSd = 0;
|
||||
UINT64 diskSizeEmmc = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE);
|
||||
UINT64 diskFreeEmmc = FileSys_GetDiskInfoEx('B', FST_INFO_FREE_SPACE);
|
||||
char * textLabel;
|
||||
// char * textLabelError;
|
||||
UINT16 idLeft;
|
||||
UINT16 idRight;
|
||||
BOOL setWarning = false;
|
||||
|
||||
lv_plugin_res_id res[] = {
|
||||
LV_PLUGIN_IMG_ID_SF_SD_NO,
|
||||
LV_PLUGIN_IMG_ID_SF_SD_2GB,
|
||||
|
@ -793,76 +757,143 @@ static void update_sd_card_status(lv_obj_t* obj)
|
|||
LV_PLUGIN_IMG_ID_SF_SD_256GB,
|
||||
LV_PLUGIN_IMG_ID_SF_SD_FULL
|
||||
};
|
||||
UINT64 diskSize = 0;
|
||||
UINT64 diskFree = 0;
|
||||
unsigned int index = 0;
|
||||
UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
|
||||
if (cardStatus != CARD_REMOVED)
|
||||
{
|
||||
diskSize = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE);
|
||||
diskFree = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
|
||||
//printf("[%s]SD Card disk size : %lld, disk free : %lld\n", __FUNCTION__, diskSize, diskFree);
|
||||
if (0 == diskSize)
|
||||
{
|
||||
//printf("[%s]SD CARD ERROR :%lld\n", __FUNCTION__, diskSize);
|
||||
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, "SD Card Error");
|
||||
return;
|
||||
}
|
||||
else if (diskFree < (FREE_SIZE_MB*1024*1024))
|
||||
{
|
||||
//printf("[%s]SD CARD FULL :%lld\n", __FUNCTION__, diskFree);
|
||||
lv_plugin_img_set_src(obj, LV_PLUGIN_IMG_ID_SF_SD_FULL);
|
||||
set_warning_label_text(label_6_scr_uiflowphoto);
|
||||
lv_label_set_text(label_6_scr_uiflowphoto, "SD Card FULL");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("[%s]SD CARD NORMAL :%lld\n", __FUNCTION__, diskFree);
|
||||
index = check_sd_size(diskSize);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
set_warning_label_text(label_6_scr_uiflowphoto);
|
||||
lv_label_set_text(label_6_scr_uiflowphoto, "No SD Card");
|
||||
}
|
||||
lv_plugin_img_set_src(obj, res[index]);
|
||||
}
|
||||
|
||||
static void update_emmc_status(lv_obj_t* obj)
|
||||
{
|
||||
UINT64 diskSize = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE);
|
||||
UINT64 diskFree = FileSys_GetDiskInfoEx('B', FST_INFO_FREE_SPACE);
|
||||
//SF_ST_MMC_DEV *mmc_dev = SF_GetMMCDev();
|
||||
//printf("[%s]EMMC disk size : %lld, disk free : %lld\n", __FUNCTION__, diskSize, diskFree);
|
||||
//if (MMC_DEV_SPACE_STATE_NO_ENOUGH == mmc_dev->space_state)
|
||||
if (0 == diskSize)
|
||||
{
|
||||
//printf("[%s]EMMC ERROR :%lld\n", __FUNCTION__, diskSize);
|
||||
lv_plugin_img_set_src(obj, 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");
|
||||
|
||||
if(CARD_REMOVED == cardStatus)
|
||||
{/*no sd card*/
|
||||
if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc normal*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_SD_NO;
|
||||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
textLabel = Get_FreePicNumString(g_uiFreePicNum);
|
||||
// textLabelError = "";
|
||||
setWarning = false;
|
||||
}
|
||||
else if (0 == diskSizeEmmc)
|
||||
{/*emmc error*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_NO;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
|
||||
textLabel = "SD CARD Error";
|
||||
// textLabelError = "EMMC Error, Please format it";
|
||||
setWarning = true;
|
||||
}
|
||||
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc full*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_NO;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
|
||||
textLabel = "No SD Card";
|
||||
// textLabelError = "";
|
||||
setWarning = true;
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else if(diskFree < (FREE_SIZE_MB*1024*1024))
|
||||
{
|
||||
//printf("[%s]EMMC FULL :%lld\n", __FUNCTION__, diskFree);
|
||||
lv_plugin_img_set_src(obj, 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");
|
||||
else{
|
||||
diskSizeSd = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE);
|
||||
diskFreeSd = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
|
||||
|
||||
if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024) && diskSizeSd > 0 && diskFreeSd >= (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc normal sd normal*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
|
||||
idRight = res[check_sd_size(diskSizeSd)];
|
||||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
textLabel = Get_FreePicNumString(g_uiFreePicNum);
|
||||
// textLabelError = "";
|
||||
setWarning = false;
|
||||
}
|
||||
else if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024) && 0 == diskSizeSd)
|
||||
{/*emmc normal sd error*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
|
||||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
textLabel = Get_FreePicNumString(g_uiFreePicNum);
|
||||
// textLabelError = "";
|
||||
setWarning = false;
|
||||
}
|
||||
else if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024) && diskFreeSd < (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc normal sd full*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
|
||||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
textLabel = Get_FreePicNumString(g_uiFreePicNum);
|
||||
// textLabelError = "";
|
||||
setWarning = false;
|
||||
}
|
||||
else if (0 == diskSizeEmmc && diskSizeSd > 0 && diskFreeSd >= (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc error sd normal*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_FULL;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
|
||||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
textLabel = Get_FreePicNumString(g_uiFreePicNum);
|
||||
// textLabelError = "";
|
||||
setWarning = false;
|
||||
}
|
||||
else if (0 == diskSizeEmmc && 0 == diskSizeSd)
|
||||
{/*emmc error sd error*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_DIS;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
|
||||
textLabel = "SD CARD Error";
|
||||
// textLabelError = "EMMC and SD Card Error, Please format it";
|
||||
setWarning = true;
|
||||
}
|
||||
else if (0 == diskSizeEmmc && 0 != diskSizeSd && diskFreeSd <= (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc error sd full*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_FULL;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
|
||||
textLabel = "SD CARD Full";
|
||||
// textLabelError = "EMMC Error, Please format it";
|
||||
setWarning = true;
|
||||
}
|
||||
|
||||
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024) && diskSizeSd > 0 && diskFreeSd >= (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc full sd normal*/
|
||||
idLeft = res[check_sd_size(diskSizeSd)];
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
|
||||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
textLabel = Get_FreePicNumString(g_uiFreePicNum);
|
||||
// textLabelError = "";
|
||||
setWarning = false;
|
||||
}
|
||||
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024) && 0 == diskSizeSd)
|
||||
{/*emmc full sd error*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_DIS;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
|
||||
textLabel = "SD CARD Error";
|
||||
// textLabelError = "SD Card Error, Please format it";
|
||||
setWarning = true;
|
||||
}
|
||||
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024) && diskFreeSd < (FREE_SIZE_MB*1024*1024))
|
||||
{/*emmc full sd full*/
|
||||
idLeft = LV_PLUGIN_IMG_ID_SF_SD_FULL;
|
||||
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
|
||||
textLabel = "SD CARD Full";
|
||||
// textLabelError = "";
|
||||
setWarning = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lv_plugin_img_set_src(image_8_scr_uiflowphoto, idLeft);
|
||||
lv_plugin_img_set_src(image_9_scr_uiflowphoto, idRight);
|
||||
if (setWarning)
|
||||
{
|
||||
set_warning_label_text(label_6_scr_uiflowphoto);
|
||||
}
|
||||
//else if (MMC_DEV_MOUNT_STATE_UNMOUNTED == mmc_dev->moumted_state)
|
||||
else
|
||||
{
|
||||
//printf("[%s]EMMC NORMAL :%lld\n", __FUNCTION__, diskFree);
|
||||
lv_plugin_img_set_src(obj, LV_PLUGIN_IMG_ID_SF_SD_EMMC);
|
||||
set_normal_label_text(label_6_scr_uiflowphoto);
|
||||
}
|
||||
|
||||
lv_label_set_text(label_6_scr_uiflowphoto, textLabel);
|
||||
}
|
||||
|
||||
|
||||
static void update_storage_message(void)
|
||||
{
|
||||
if (1 == first_check_storage)
|
||||
|
@ -880,7 +911,8 @@ static void update_storage_message(void)
|
|||
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);
|
||||
|
@ -890,57 +922,13 @@ 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__);
|
||||
update_emmc_status(image_9_scr_uiflowphoto);
|
||||
update_sd_card_status(image_8_scr_uiflowphoto);
|
||||
update_storage_sd_card();
|
||||
}
|
||||
else if (MMC_DEV_EMMC == get_storage_type())
|
||||
{
|
||||
//printf("[%s]EMMC storage\n", __FUNCTION__);
|
||||
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__);
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_plugin_img_set_src(image_9_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_DIS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
update_sd_emmc_status();
|
||||
}
|
||||
|
||||
static void update_camera_message(void)
|
||||
{
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
|
@ -2053,7 +2041,11 @@ 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;
|
||||
if(CARD_REMOVED == System_GetState(SYS_STATE_CARD))
|
||||
{
|
||||
g_SysStrg_Chg = true;
|
||||
}
|
||||
|
||||
//#NT#2023/11/21#Eric - end
|
||||
UIFlowPhoto_OnStorageChange(obj, msg);
|
||||
break;
|
||||
|
@ -2093,7 +2085,7 @@ static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m
|
|||
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
|
||||
printf("[*x]====UI_StorageCheck: g_uiFreePicNum = 0x%ld\r\n", g_uiFreePicNum);
|
||||
DBG_DUMP("UI_StorageCheck: g_uiFreePicNum = 0x%ld\r\n", g_uiFreePicNum);
|
||||
lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum));
|
||||
//lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2295,7 +2287,10 @@ void UIFlowPhotoEventCallback(lv_obj_t* obj, lv_event_t event)
|
|||
|
||||
UIFlowPhoto_ScrOpen(obj);//LV_ALIGN_IN_RIGHT_MID
|
||||
if (sf_get_mcu_update_flag() == SF_TRUE) {
|
||||
lv_obj_set_hidden(container_mcu_upgrade_scr_uiflowphoto, false);
|
||||
if((access("/mnt/sd/Mupgrade.bin", F_OK) == 0) || (access("/mnt/sd2/Mupgrade.bin", F_OK) == 0))
|
||||
{
|
||||
lv_obj_set_hidden(container_mcu_upgrade_scr_uiflowphoto, false);
|
||||
}
|
||||
}
|
||||
|
||||
#define PASSWORD_OPENED 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user