From 53bf5442ed907521c8799c20d72c31d945324332 Mon Sep 17 00:00:00 2001 From: payton Date: Tue, 7 Nov 2023 21:52:08 +0800 Subject: [PATCH] =?UTF-8?q?1.30M=E5=89=A9=E4=BD=99=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/cardv/SrcCode/System/sys_filesys.c | 10 ++++ .../cardv/SrcCode/UIApp/MovieFast/MovieFast.c | 6 ++- .../cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c | 9 +++- .../UIApp/PhotoFast/PhotoFastSliceEncode.c | 28 +++++----- .../driver/na51089/source/mcu/sf_sd_common.c | 51 ++++++++++--------- 5 files changed, 64 insertions(+), 40 deletions(-) diff --git a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c index ab0e78504..817f049e1 100755 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c @@ -12,6 +12,9 @@ #include "sys_fastboot.h" #include "PrjCfg.h" #include "DxHunting.h" +#if HUNTING_CAMERA_MCU == ENABLE +#include +#endif #if (HUNTING_CAMERA_MODEL == ENABLE) #include "IOCfg.h" @@ -56,6 +59,13 @@ static void card_insert_job(void) // call the function to wait init finish FileSys_WaitFinishEx('A'); FileSys_SetParamEx('A', FST_PARM_UPDATE_FSINFO , TRUE); +#if HUNTING_CAMERA_MCU == ENABLE + if(TRUE == sf_check_card_full()) + { + printf("ERR card full\r\n"); + } +#endif + fastboot_set_done(BOOT_INIT_FILESYSOK); printf("filesys_init e\r\n"); } diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c index cac62c5b1..dc8a978ef 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c @@ -871,7 +871,11 @@ static void MovieFast_WriteFile_Task(void* arg) MOVIEFAST_WRITE_QUEUE_PARAM* param; fastboot_wait_done(BOOT_INIT_FILESYSOK); - + if(TRUE == sf_is_card_full()) + { + DBG_ERR("ERR card full\r\n"); + return ; + } while(1) { param = (MOVIEFAST_WRITE_QUEUE_PARAM*) lfqueue_deq(queue); diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c index b2be865dd..bf8d965d5 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c @@ -890,6 +890,13 @@ INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, //sprintf(tmp, "W%03ld%04ld.JPG", nextFolderID, nextFileID); strncpy(g_photo_fast_write_file_Path, tmp, sizeof(g_photo_fast_write_file_Path) - 1); DBG_IND("last send file:%s\r\n", tmp); + if(TRUE == sf_is_card_full()) + { + DBG_ERR("ERR Addr=0x%x,Size=0x%x,Fmt=%d card full\r\n", Addr, Size, Fmt); + rt =FST_STA_ERROR; + return rt; + } + #else strncpy(g_photo_fast_write_file_Path, FilePath, sizeof(g_photo_fast_write_file_Path) - 1); #endif @@ -1799,7 +1806,7 @@ exit: #if SF_TRIGGER_TIME_TEST == ENABLE sf_trigger_time_led_cb(0); #endif - if(sf_get_power_off_flag()) + if((sf_get_power_off_flag()) || (TRUE == sf_is_card_full())) { vos_flag_set(PHOTOFAST_FLG_ID, FLGPHOTOFAST_SHUTDOWN); } diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c index 37ff41594..8b2fad330 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c @@ -2371,21 +2371,23 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data) DBG_IND("PHOTO THUMB %s\n", tmp); vos_perf_mark(&t3); + if(FALSE == sf_is_card_full()) + { + FST_FILE fp = FileSys_OpenFile(tmp, FST_CREATE_ALWAYS | FST_OPEN_WRITE); - FST_FILE fp = FileSys_OpenFile(tmp, FST_CREATE_ALWAYS | FST_OPEN_WRITE); + FileSys_WriteFile(fp, (UINT8*)queue_ele_in->jpg_thumb_addr, &queue_ele_in->jpg_thumb_size, 0, NULL); + FileSys_FlushFile(fp); + FileSys_CloseFile(fp); + #if HUNTING_CAMERA_MCU == ENABLE + memset(tmp, '\0', sizeof(tmp)); + snprintf(tmp, sizeof(tmp), "%s/%s", SF_SEND_LIST_DIR, file_path); /* DCF 8.3 naming rule */ + snprintf(tmp2, sizeof(tmp2), "%s", file_path); /* DCF 8.3 naming rule */ + sf_file_thumb_cfg_fill(tmp, tmp2, queue_ele_in->jpg_thumb_size, SF_FILE_TYPE_PIC_SMALL); + DBG_IND("PHOTO THUMB %s \n %s\n %s\n", tmp, tmp2,file_path); + DBG_IND("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,queue_ele_in->jpg_thumb_size,tmp2,tmp); + #endif + } - FileSys_WriteFile(fp, (UINT8*)queue_ele_in->jpg_thumb_addr, &queue_ele_in->jpg_thumb_size, 0, NULL); - FileSys_FlushFile(fp); - FileSys_CloseFile(fp); - -#if HUNTING_CAMERA_MCU == ENABLE - memset(tmp, '\0', sizeof(tmp)); - snprintf(tmp, sizeof(tmp), "%s/%s", SF_SEND_LIST_DIR, file_path); /* DCF 8.3 naming rule */ - snprintf(tmp2, sizeof(tmp2), "%s", file_path); /* DCF 8.3 naming rule */ - sf_file_thumb_cfg_fill(tmp, tmp2, queue_ele_in->jpg_thumb_size, SF_FILE_TYPE_PIC_SMALL); - DBG_IND("PHOTO THUMB %s \n %s\n %s\n", tmp, tmp2,file_path); - DBG_IND("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,queue_ele_in->jpg_thumb_size,tmp2,tmp); -#endif } vos_perf_mark(&t4); diff --git a/rtos/code/driver/na51089/source/mcu/sf_sd_common.c b/rtos/code/driver/na51089/source/mcu/sf_sd_common.c index 8cb302be4..dc2ea25d4 100755 --- a/rtos/code/driver/na51089/source/mcu/sf_sd_common.c +++ b/rtos/code/driver/na51089/source/mcu/sf_sd_common.c @@ -55,38 +55,39 @@ BOOL sf_is_card_full(void) } - UINT32 sf_check_card_full(void) { - UINT64 diskFree = 0; - UINT32 ret = 0; - - UIMenuStoreInfo *puiPara = sf_ui_para_get(); + int diskFree = 0; + UINT32 ret = 0; + + //UIMenuStoreInfo *puiPara = sf_ui_para_get(); if(!sf_in_card_exist()) { return 1; } - /*check disk free size*/ - diskFree = FileSys_GetDiskInfo(FST_INFO_FREE_SPACE); - diskFree = diskFree/1024; - - if(diskFree < 30) /* 30MB */ - { - ret = TRUE; - if(0 == puiPara->SdLoopSwitch) - { - IsCardFull = TRUE; - } - //printf("%s:%d sd card is full diskFree=%lu",__FUNCTION__,__LINE__,diskFree); - } - else - { - ret = FALSE; - //printf("%s:%d sd card no full diskFree=%lu",__FUNCTION__,__LINE__,diskFree); - } - //printf("%s:%d sd card diskFree(%lu)",__FUNCTION__,__LINE__,diskFree); - return ret; + /*check disk free size*/ + diskFree = FileSys_GetDiskInfo(FST_INFO_FREE_SPACE); + diskFree = diskFree/1024/1024; + + if(diskFree < 30) /* 30MB */ + { + ret = TRUE; + //if(0 == puiPara->SdLoopSwitch) + { + IsCardFull = TRUE; + } + //printf("%s:%d sd card is full diskFree=%lu",__FUNCTION__,__LINE__,diskFree); + } + else + { + ret = FALSE; + //printf("%s:%d sd card no full diskFree=%lu",__FUNCTION__,__LINE__,diskFree); + } + + //printf("[%s:%d]sd card diskFree=%dM\n", __FUNCTION__, __LINE__, diskFree); + + return ret; } void sf_sd_exist_reg_cb(SF_CALLBACK_SD_CMD fpCB)