FIX: fixed the following issues

1.fixed the problem that M30/M30T failed to upload kmz file on some firmware versions.
2.fixed the download camera media file name issue on M30/M30T.
3.fixed the unstable problem of downloading camera media files on M30/M30T.
4.improved the speed of downloading camera media files.

Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
DJI-Martin
2023-02-20 11:19:27 +08:00
parent 8b2d0735cd
commit 84714c112a
19 changed files with 14 additions and 9 deletions

View File

@ -86,7 +86,7 @@ start:
<< "| [i] Start power management sample - you will see notification when aircraft power off |\n"
<< "| [j] Start data transmission sample - you can send or recv custom data on MSDK demo |\n"
<< "| [l] Run camera manager sample - shoot photo by the selected camera mounted position |\n"
<< "| [m] Run camera manager download sample - download camera media file (only support on M3E/M3T) |\n"
<< "| [m] Run camera manager download sample - download camera media file (not support on M3E/M3T) |\n"
<< std::endl;
std::cin >> inputChar;

View File

@ -63,6 +63,7 @@ static T_DjiCameraManagerFileList s_meidaFileList;
static uint32_t downloadStartMs = 0;
static uint32_t downloadEndMs = 0;
static char downloadFileName[TEST_CAMERA_MANAGER_MEDIA_FILE_NAME_MAX_SIZE] = {0};
static uint32_t nextDownloadFileIndex = 0;
/* Private functions declaration ---------------------------------------------*/
static uint8_t DjiTest_CameraManagerGetCameraTypeIndex(E_DjiCameraType cameraType);
@ -1159,6 +1160,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
T_DjiReturnCode returnCode;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
uint16_t downloadCount = 0;
nextDownloadFileIndex = 0;
returnCode = DjiCameraManager_RegDownloadFileDataCallback(position, DjiTest_CameraManagerDownloadFileDataCallback);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
@ -1210,17 +1212,19 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
osalHandler->TaskSleepMs(1000);
if (s_meidaFileList.totalCount < TEST_CAMERA_MANAGER_MEDIA_DOWNLOAD_FILE_NUM) {
downloadCount = s_meidaFileList.totalCount;
} else {
downloadCount = TEST_CAMERA_MANAGER_MEDIA_DOWNLOAD_FILE_NUM;
}
downloadCount = s_meidaFileList.totalCount;
for (int i = 0; i < downloadCount; ++i) {
redownload:
if (i != nextDownloadFileIndex) {
i = nextDownloadFileIndex;
}
returnCode = DjiCameraManager_DownloadFileByIndex(position, s_meidaFileList.fileListInfo[i].fileIndex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Download media file by index failed, error code: 0x%08X.", returnCode);
return returnCode;
nextDownloadFileIndex--;
goto redownload;
}
}
@ -1248,6 +1252,7 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_START) {
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
if (s_meidaFileList.fileListInfo[i].fileIndex == packetInfo.fileIndex) {
nextDownloadFileIndex = i + 1;
break;
}
}
@ -1255,7 +1260,7 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
memset(downloadFileName, 0, sizeof(downloadFileName));
snprintf(downloadFileName, sizeof(downloadFileName), "%s", s_meidaFileList.fileListInfo[i].fileName);
USER_LOG_INFO("Start download media file");
USER_LOG_INFO("Start download media file, index : %d, next download media file, index: %d", i, nextDownloadFileIndex);
s_downloadMediaFile = fopen(downloadFileName, "wb+");
if (s_downloadMediaFile == NULL) {
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;