NEW: release DJI Payload-SDK version 3.8.1
This commit is contained in:
@ -45,7 +45,6 @@ static const char *s_cameraManagerSampleSelectList[] = {
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAMERA_TAP_ZOOM_POINT] = "Set camera tap zoom point |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAMERA_ZOOM_PARAM] = "Set camera zoom param |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_SINGLE_PHOTO] = "Shoot single photo |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_AEB_PHOTO] = "Shoot aeb photo |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_BURST_PHOTO] = "Shoot busrt photo |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_INTERVAL_PHOTO] = "Shoot interval photo |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RECORD_VIDEO] = "Record video |",
|
||||
|
||||
@ -210,17 +210,9 @@ static void DjiUser_ShowRgbImageCallback(CameraRGBImage img, void *userData)
|
||||
cout << " x: " << faces[i].x;
|
||||
cout << " y: " << faces[i].y << endl;
|
||||
|
||||
#ifdef OPEN_CV_VERSION_3
|
||||
cv::rectangle(mat, cvPoint(faces[i].x, faces[i].y),
|
||||
cvPoint(faces[i].x + faces[i].width, faces[i].y + faces[i].height),
|
||||
Scalar(0, 0, 255), 2, 1, 0);
|
||||
#endif
|
||||
|
||||
#ifdef OPEN_CV_VERSION_4
|
||||
cv::rectangle(mat, cv::Point(faces[i].x, faces[i].y),
|
||||
cv::Point(faces[i].x + faces[i].width, faces[i].y + faces[i].height),
|
||||
Scalar(0, 0, 255), 2, 1, 0);
|
||||
#endif
|
||||
}
|
||||
imshow(name, mat);
|
||||
} else if (s_demoIndex == 3) {
|
||||
@ -279,15 +271,8 @@ static void DjiUser_ShowRgbImageCallback(CameraRGBImage img, void *userData)
|
||||
|
||||
int baseLine = 0;
|
||||
Size labelSize = getTextSize(label, FONT_HERSHEY_SIMPLEX, 0.5, 1, &baseLine);
|
||||
#ifdef OPEN_CV_VERSION_3
|
||||
rectangle(mat, Rect(Point(xLeftBottom, yLeftBottom - labelSize.height),
|
||||
Size(labelSize.width, labelSize.height + baseLine)), Scalar(0, 255, 0), CV_FILLED);
|
||||
#endif
|
||||
|
||||
#ifdef OPEN_CV_VERSION_4
|
||||
rectangle(mat, Rect(Point(xLeftBottom, yLeftBottom - labelSize.height),
|
||||
Size(labelSize.width, labelSize.height + baseLine)), Scalar(0, 255, 0), cv::FILLED);
|
||||
#endif
|
||||
putText(mat, label, Point(xLeftBottom, yLeftBottom), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,15 +379,8 @@ static void *DjiTest_StereoImagesDisplayTask(void *arg)
|
||||
sprintf(&showFpsString[i][0], "%s%d", fpsStr, fps);
|
||||
}
|
||||
timePrev[i] = timeNow[i];
|
||||
#ifdef OPEN_CV_VERSION_3
|
||||
cv::putText(cv_img_stereo, &showFpsString[i][0], cv::Point(5, 20),
|
||||
CV_FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 0));
|
||||
#endif
|
||||
|
||||
#ifdef OPEN_CV_VERSION_4
|
||||
cv::putText(cv_img_stereo, &showFpsString[i][0], cv::Point(5, 20),
|
||||
cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 0));
|
||||
#endif
|
||||
}
|
||||
cv::imshow(nameStr, cv_img_stereo);
|
||||
cv::waitKey(1);
|
||||
|
||||
@ -71,13 +71,6 @@ if (OpenCV_FOUND)
|
||||
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
|
||||
add_definitions(-DOPEN_CV_INSTALLED)
|
||||
if ("${OpenCV_VERSION}" STRLESS "4.0.0")
|
||||
add_definitions(-DOPEN_CV_VERSION_3)
|
||||
|
||||
else ()
|
||||
add_definitions(-DOPEN_CV_VERSION_4)
|
||||
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||
endif ()
|
||||
@ -89,10 +82,10 @@ if (FFMPEG_FOUND)
|
||||
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ffmpeg -version
|
||||
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
|
||||
OUTPUT_VARIABLE ffmpeg_version_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_psdk_libput})
|
||||
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_output})
|
||||
string(REGEX MATCH " .* " ffmpeg_version ${ffmpeg_version_line})
|
||||
string(REGEX MATCH "^ 5.*$" ffmpeg_major_version ${ffmpeg_version})
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
#include <dji_aircraft_info.h>
|
||||
#include <csignal>
|
||||
#include "dji_sdk_config.h"
|
||||
#include "dji_config_manager.h"
|
||||
|
||||
#include "../common/osal/osal.h"
|
||||
#include "../common/osal/osal_fs.h"
|
||||
@ -40,6 +39,7 @@
|
||||
#include "../manifold2/hal/hal_uart.h"
|
||||
#include "../manifold2/hal/hal_network.h"
|
||||
|
||||
#include "utils/dji_config_manager.h"
|
||||
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
||||
#include <camera_emu/test_payload_cam_emu_media.h>
|
||||
#include <camera_emu/test_payload_cam_emu_base.h>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "stdio.h"
|
||||
#include "hal_network.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_config_manager.h"
|
||||
#include "utils/dji_config_manager.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
@ -63,7 +63,7 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
|
||||
strcpy(networkDeviceName, LINUX_NETWORK_DEV);
|
||||
}
|
||||
|
||||
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", LINUX_NETWORK_DEV);
|
||||
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", networkDeviceName);
|
||||
ret = system(cmdStr);
|
||||
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Can't open the network."
|
||||
@ -72,7 +72,7 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s %s netmask %s", LINUX_NETWORK_DEV, ipAddr, netMask);
|
||||
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s %s netmask %s", networkDeviceName, ipAddr, netMask);
|
||||
ret = system(cmdStr);
|
||||
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Can't config the ip address of network."
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <dji_logger.h>
|
||||
#include "hal_uart.h"
|
||||
#include "dji_config_manager.h"
|
||||
#include "utils/dji_config_manager.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define UART_DEV_NAME_STR_SIZE (128)
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "hal_usb_bulk.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_config_manager.h"
|
||||
#include "utils/dji_config_manager.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define LINUX_USB_BULK_TRANSFER_TIMEOUT_MS (50)
|
||||
|
||||
@ -54,13 +54,6 @@ if (OpenCV_FOUND)
|
||||
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
|
||||
add_definitions(-DOPEN_CV_INSTALLED)
|
||||
if ("${OpenCV_VERSION}" STRLESS "4.0.0")
|
||||
add_definitions(-DOPEN_CV_VERSION_3)
|
||||
|
||||
else ()
|
||||
add_definitions(-DOPEN_CV_VERSION_4)
|
||||
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||
endif ()
|
||||
@ -72,10 +65,10 @@ if (FFMPEG_FOUND)
|
||||
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ffmpeg -version
|
||||
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
|
||||
OUTPUT_VARIABLE ffmpeg_version_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_psdk_libput})
|
||||
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_output})
|
||||
string(REGEX MATCH " .* " ffmpeg_version ${ffmpeg_version_line})
|
||||
string(REGEX MATCH "^ 5.*$" ffmpeg_major_version ${ffmpeg_version})
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
#define TEST_CAMERA_MOP_CHANNEL_WAIT_TIME_MS (3 * 1000)
|
||||
#define TEST_CAMERA_MOP_CHANNEL_MAX_RECV_COUNT 30
|
||||
#define TEST_CAMEAR_POINT_CLOUD_FILE_PATH_STR_MAX_SIZE 256
|
||||
#define TEST_CAMEAR_MEDIA_SUB_FILE_NOT_FOUND -1
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
@ -625,80 +626,6 @@ T_DjiReturnCode DjiTest_CameraManagerStartShootBurstPhoto(E_DjiMountPosition pos
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/*! @brief Sample to shoot AEB photo, using async api
|
||||
*
|
||||
* @note In this interface, camera will be set to be the SHOOT_PHOTO mode
|
||||
* then start to shoot a AEB photo.
|
||||
* @param index payload node index, input limit see enum
|
||||
* DJI::OSDK::PayloadIndexType
|
||||
* @param photoNum The number of pictures in each AEB shooting
|
||||
* @return T_DjiReturnCode error code
|
||||
*/
|
||||
T_DjiReturnCode DjiTest_CameraManagerStartShootAEBPhoto(E_DjiMountPosition position,
|
||||
E_DjiCameraManagerPhotoAEBCount aebCount)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
E_DjiCameraManagerWorkMode workMode;
|
||||
|
||||
/*!< set camera work mode as shoot photo */
|
||||
USER_LOG_INFO("set mounted position %d camera's work mode as shoot photo mode.", position);
|
||||
returnCode = DjiCameraManager_SetMode(position, DJI_CAMERA_MANAGER_WORK_MODE_SHOOT_PHOTO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
USER_LOG_ERROR("set mounted position %d camera's work mode as shoot photo mode failed,"
|
||||
" error code :0x%08X.", position, returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
|
||||
returnCode = DjiCameraManager_GetMode(position, &workMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
USER_LOG_ERROR("get mounted position %d camera's work mode failed,"
|
||||
" error code :0x%08X", position, returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
USER_LOG_INFO("Camera current workmode is %d", workMode);
|
||||
|
||||
/*!< set shoot-photo mode */
|
||||
USER_LOG_INFO("Set mounted position %d camera's shoot photo mode as AEB-photo mode", position);
|
||||
returnCode = DjiCameraManager_SetShootPhotoMode(position, DJI_CAMERA_MANAGER_SHOOT_PHOTO_MODE_AEB);
|
||||
if (returnCode == DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("set mounted position %d camera's shoot photo mode as AEB-photo mode failed,"
|
||||
" error code :0x%08X.", position, returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/*! wait the APP change the shoot-photo mode display */
|
||||
USER_LOG_INFO("Sleep 0.5s...");
|
||||
osalHandler->TaskSleepMs(500);
|
||||
|
||||
/*!< set shoot-photo mode parameter */
|
||||
USER_LOG_INFO("Set mounted position %d camera's AEB count to %d", position, aebCount);
|
||||
returnCode = DjiCameraManager_SetPhotoAEBCount(position, aebCount);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
USER_LOG_ERROR("set mounted position %d camera's AEB count(%d) failed,"
|
||||
" error code :0x%08X.", position, aebCount, returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
/*!< start to shoot single photo */
|
||||
USER_LOG_INFO("Mounted position %d camera start to shoot photo.", position);
|
||||
returnCode = DjiCameraManager_StartShootPhoto(position, DJI_CAMERA_MANAGER_SHOOT_PHOTO_MODE_AEB);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Mounted position %d camera shoot photo failed, "
|
||||
"error code :0x%08X.", position, returnCode);
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/*! @brief Sample to start shooting interval photo, using async api
|
||||
*
|
||||
* @note In this interface, camera will be set to be the SHOOT_PHOTO mode
|
||||
@ -1135,17 +1062,6 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_AEB_PHOTO: {
|
||||
USER_LOG_INFO("--> Function i: Shoot AEB photo with 3 pictures in one time");
|
||||
DjiTest_WidgetLogAppend("--> Function i: Shoot AEB photo with 3 pictures in one time");
|
||||
returnCode = DjiTest_CameraManagerStartShootAEBPhoto(mountPosition, DJI_CAMERA_MANAGER_PHOTO_AEB_COUNT_3);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Mounted position %d camera shoot AEB photo failed,"
|
||||
"error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_BURST_PHOTO: {
|
||||
USER_LOG_INFO("--> Function j: Shoot Burst photo with 5 pictures in one time");
|
||||
DjiTest_WidgetLogAppend("--> Function j: Shoot Burst photo with 5pictures in one time");
|
||||
@ -1487,12 +1403,6 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO: {
|
||||
T_DjiCameraManagerStorageInfo storageInfo;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3D || cameraType == DJI_CAMERA_TYPE_M3TD) {
|
||||
USER_LOG_INFO("Position %d, camera type %d, doesn't support get storage info. Sample exits.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 30; i++) {
|
||||
returnCode = DjiCameraManager_GetStorageInfo(mountPosition, &storageInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -1775,7 +1685,7 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
returnCode = DjiCameraManager_GetPhotoFormatStorageRange(mountPosition, &photoFormatRange);
|
||||
returnCode = DjiCameraManager_GetPhotoStorageFormatRange(mountPosition, &photoFormatRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get range failed!");
|
||||
goto exitCameraModule;
|
||||
@ -2102,8 +2012,7 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
uint16_t recordingTime;
|
||||
uint8_t remainingTime;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3D || cameraType == DJI_CAMERA_TYPE_M3TD) {
|
||||
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1) {
|
||||
USER_LOG_INFO("Camera type %d does not support to get camera stauts such as "
|
||||
"capturing state, recording state.", cameraType);
|
||||
goto exitCameraModule;
|
||||
@ -2192,6 +2101,8 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
uint16_t downloadCount = 0;
|
||||
uint16_t subFileDownloadCount = 0;
|
||||
int i = 0, j= 0;
|
||||
|
||||
s_nextDownloadFileIndex = 0;
|
||||
returnCode = DjiCameraManager_RegDownloadFileDataCallback(position, DjiTest_CameraManagerDownloadFileDataCallback);
|
||||
@ -2213,11 +2124,13 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
|
||||
if (s_meidaFileList.totalCount > 0) {
|
||||
downloadCount = s_meidaFileList.totalCount;
|
||||
subFileDownloadCount = s_meidaFileList.fileListInfo->subFileListTotalNum;
|
||||
printf(
|
||||
"\033[1;33;40m -> Download file list finished, total file count is %d, the following %d is list details: \033[0m\r\n",
|
||||
"\033[1;33;40m -> Download file list finished, total media file count is %d "
|
||||
"the following %d is list details: \033[0m\r\n",
|
||||
s_meidaFileList.totalCount, downloadCount);
|
||||
for (int i = 0; i < downloadCount; ++i) {
|
||||
if (s_meidaFileList.fileListInfo[i].fileSize < 1 * 1024 * 1024) {
|
||||
|
||||
for (i = 0; i < downloadCount; ++i) {
|
||||
printf(
|
||||
"\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d \033[0m\r\n",
|
||||
i, s_meidaFileList.fileListInfo[i].fileName,
|
||||
@ -2228,21 +2141,23 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
s_meidaFileList.fileListInfo[i].createTime.hour,
|
||||
s_meidaFileList.fileListInfo[i].createTime.minute,
|
||||
s_meidaFileList.fileListInfo[i].createTime.second,
|
||||
(dji_f32_t) s_meidaFileList.fileListInfo[i].fileSize / 1024,
|
||||
s_meidaFileList.fileListInfo[i].type);
|
||||
} else {
|
||||
printf(
|
||||
"\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d \033[0m\r\n",
|
||||
i, s_meidaFileList.fileListInfo[i].fileName,
|
||||
s_meidaFileList.fileListInfo[i].fileIndex,
|
||||
s_meidaFileList.fileListInfo[i].createTime.year,
|
||||
s_meidaFileList.fileListInfo[i].createTime.month,
|
||||
s_meidaFileList.fileListInfo[i].createTime.day,
|
||||
s_meidaFileList.fileListInfo[i].createTime.hour,
|
||||
s_meidaFileList.fileListInfo[i].createTime.minute,
|
||||
s_meidaFileList.fileListInfo[i].createTime.second,
|
||||
(dji_f32_t) s_meidaFileList.fileListInfo[i].fileSize / (1024 * 1024),
|
||||
(dji_f32_t) s_meidaFileList.fileListInfo[i].fileSize / (1024),
|
||||
s_meidaFileList.fileListInfo[i].type);
|
||||
if (s_meidaFileList.fileListInfo[i].type == DJI_CAMERA_FILE_TYPE_LDRT) {
|
||||
for (j = 0; j < s_meidaFileList.fileListInfo[i].subFileListTotalNum; j++) {
|
||||
printf(
|
||||
"\033[1;32;40m ### Media file_%03d, sub_file_%03d, name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, sub type: %d\033[0m\r\n",
|
||||
i, j, s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileName,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileIndex,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].createTime.year,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].createTime.month,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].createTime.day,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].createTime.hour,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].createTime.minute,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].createTime.second,
|
||||
(dji_f32_t) s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileSize / (1024),
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\r\n");
|
||||
@ -2251,24 +2166,38 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
|
||||
downloadCount = s_meidaFileList.totalCount;
|
||||
|
||||
for (int i = 0; i < downloadCount; ++i) {
|
||||
redownload:
|
||||
for (i = 0; i < downloadCount; ++i) {
|
||||
redownload:
|
||||
if (i != s_nextDownloadFileIndex) {
|
||||
i = s_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);
|
||||
s_nextDownloadFileIndex--;
|
||||
goto redownload;
|
||||
}
|
||||
if (s_meidaFileList.fileListInfo[i].type == DJI_CAMERA_FILE_TYPE_LDRT) {
|
||||
for (j = 0; j < s_meidaFileList.fileListInfo[i].subFileListTotalNum; j++) {
|
||||
subFileRedownload:
|
||||
returnCode = DjiCameraManager_DownloadSubFileByIndexAndSubType(position,
|
||||
s_meidaFileList.fileListInfo[i].fileIndex,
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].type);
|
||||
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Download sub media file by index and type failed, error code: 0x%08X.", returnCode);
|
||||
goto subFileRedownload;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_DeleteFileByIndex(position, s_meidaFileList.fileListInfo[0].fileIndex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Delete media file by index failed, error code: 0x%08X.", returnCode);
|
||||
return returnCode;
|
||||
if (s_meidaFileList.fileListInfo[0].type == DJI_CAMERA_FILE_TYPE_JPEG) {
|
||||
returnCode = DjiCameraManager_DeleteFileByIndex(position, s_meidaFileList.fileListInfo[0].fileIndex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Delete media file by index failed, error code: 0x%08X.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
@ -2368,23 +2297,45 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM
|
||||
static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownloadFilePacketInfo packetInfo,
|
||||
const uint8_t *data, uint16_t len)
|
||||
{
|
||||
int32_t i;
|
||||
int32_t i =0, j = 0;
|
||||
float downloadSpeed = 0.0f;
|
||||
uint32_t mediaFileIndex = 0, mediaSubFileIndex = -1;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_START) {
|
||||
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
if (s_meidaFileList.fileListInfo[i].fileIndex == packetInfo.fileIndex) {
|
||||
s_nextDownloadFileIndex = i + 1;
|
||||
break;
|
||||
memset(downloadFileName, 0, sizeof(downloadFileName));
|
||||
if (packetInfo.fileType == DJI_DOWNLOAD_FILE_ORG) {
|
||||
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
if (s_meidaFileList.fileListInfo[i].fileIndex == packetInfo.fileIndex) {
|
||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s", s_meidaFileList.fileListInfo[i].fileName);
|
||||
mediaFileIndex = i;
|
||||
s_nextDownloadFileIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
for (j = 0; j < s_meidaFileList.fileListInfo[i].subFileListTotalNum; ++j) {
|
||||
if (s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileIndex == packetInfo.fileIndex &&
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].type == packetInfo.fileType) {
|
||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s",
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileName);
|
||||
mediaFileIndex = i;
|
||||
mediaSubFileIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osalHandler->GetTimeMs(&downloadStartMs);
|
||||
|
||||
memset(downloadFileName, 0, sizeof(downloadFileName));
|
||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s", s_meidaFileList.fileListInfo[i].fileName);
|
||||
USER_LOG_INFO("Start download media file, index : %d, next download media file, index: %d", i,
|
||||
s_nextDownloadFileIndex);
|
||||
if (mediaSubFileIndex != TEST_CAMEAR_MEDIA_SUB_FILE_NOT_FOUND) {
|
||||
USER_LOG_INFO("Start download media sub file, index : %d, media file, index: %d", mediaSubFileIndex, mediaFileIndex);
|
||||
} else {
|
||||
USER_LOG_INFO("Start download media file, index : %d", mediaFileIndex);
|
||||
}
|
||||
|
||||
s_downloadMediaFile = fopen(downloadFileName, "wb+");
|
||||
if (s_downloadMediaFile == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
@ -2415,6 +2366,57 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
|
||||
USER_LOG_INFO("End download media file, Download Speed %.2f KB/S\r\n\r\n", downloadSpeed);
|
||||
fclose(s_downloadMediaFile);
|
||||
s_downloadMediaFile = NULL;
|
||||
} else if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_START_TRANSFER_END) {
|
||||
|
||||
memset(downloadFileName, 0, sizeof(downloadFileName));
|
||||
if (packetInfo.fileType == DJI_DOWNLOAD_FILE_ORG) {
|
||||
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
if (s_meidaFileList.fileListInfo[i].fileIndex == packetInfo.fileIndex) {
|
||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s", s_meidaFileList.fileListInfo[i].fileName);
|
||||
mediaFileIndex = i;
|
||||
s_nextDownloadFileIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
for (j = 0; j < s_meidaFileList.fileListInfo[i].subFileListTotalNum; ++j) {
|
||||
if (s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileIndex == packetInfo.fileIndex &&
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].type == packetInfo.fileType) {
|
||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s",
|
||||
s_meidaFileList.fileListInfo[i].subFileListInfo[j].fileName);
|
||||
mediaFileIndex = i;
|
||||
mediaSubFileIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaSubFileIndex != TEST_CAMEAR_MEDIA_SUB_FILE_NOT_FOUND) {
|
||||
USER_LOG_INFO("Start download media sub file, index : %d, media file, index: %d", mediaSubFileIndex, mediaFileIndex);
|
||||
} else {
|
||||
USER_LOG_INFO("Start download media file, index : %d", mediaFileIndex);
|
||||
}
|
||||
|
||||
s_downloadMediaFile = fopen(downloadFileName, "wb+");
|
||||
if (s_downloadMediaFile == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
fwrite(data, 1, len, s_downloadMediaFile);
|
||||
|
||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %u, mediaFileIndex: %d\033[0m\r\n",
|
||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||
printf("\033[1A");
|
||||
|
||||
downloadSpeed = (float) packetInfo.fileSize / 1.0;
|
||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %u, mediaFileIndex: %d\033[0m\r\n",
|
||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||
printf("\033[1A");
|
||||
printf("\r\n");
|
||||
USER_LOG_INFO("End download media file, Download Speed %.2f KB/S\r\n\r\n", downloadSpeed);
|
||||
fclose(s_downloadMediaFile);
|
||||
s_downloadMediaFile = NULL;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
@ -2550,6 +2552,7 @@ T_DjiReturnCode DjiTest_CameraManagerSubscribePointCloud(E_DjiMountPosition posi
|
||||
T_DjiCameraManagerColorPointCloud *colorPointCloud;
|
||||
uint32_t colorPointCloudDataByte = 0;
|
||||
uint32_t colorPointsNum = 0;
|
||||
static bool isMopInit = false;
|
||||
|
||||
returnCode = DjiCameraManager_StartRecordPointCloud(position);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -2568,11 +2571,15 @@ T_DjiReturnCode DjiTest_CameraManagerSubscribePointCloud(E_DjiMountPosition posi
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
returnCode = DjiMopChannel_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
fclose(fp);
|
||||
USER_LOG_ERROR("Mop channel init error, stat:0x%08llX.", returnCode);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
if (isMopInit == false) {
|
||||
returnCode = DjiMopChannel_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
fclose(fp);
|
||||
USER_LOG_ERROR("Mop channel init error, stat:0x%08llX.", returnCode);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
} else {
|
||||
isMopInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiMopChannel_Create(&s_mopChannelHandle, DJI_MOP_CHANNEL_TRANS_UNRELIABLE);
|
||||
|
||||
@ -47,7 +47,6 @@ typedef enum {
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAMERA_TAP_ZOOM_POINT,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAMERA_ZOOM_PARAM,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_SINGLE_PHOTO,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_AEB_PHOTO,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_BURST_PHOTO,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_INTERVAL_PHOTO,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RECORD_VIDEO,
|
||||
@ -223,18 +222,6 @@ T_DjiReturnCode DjiTest_CameraManagerStartShootSinglePhoto(E_DjiMountPosition po
|
||||
T_DjiReturnCode DjiTest_CameraManagerStartShootBurstPhoto(E_DjiMountPosition position,
|
||||
E_DjiCameraBurstCount burstCount);
|
||||
|
||||
/*! @brief Sample to shoot AEB photo, using async api
|
||||
*
|
||||
* @note In this interface, camera will be set to be the SHOOT_PHOTO mode
|
||||
* then start to shoot a AEB photo.
|
||||
* @param index payload node index, input limit see enum
|
||||
* DJI::OSDK::PayloadIndexType
|
||||
* @param photoNum The number of pictures in each AEB shooting
|
||||
* @return T_DjiReturnCode error code
|
||||
*/
|
||||
T_DjiReturnCode DjiTest_CameraManagerStartShootAEBPhoto(E_DjiMountPosition position,
|
||||
E_DjiCameraManagerPhotoAEBCount aebCount);
|
||||
|
||||
/*! @brief Sample to start shooting interval photo, using async api
|
||||
*
|
||||
* @note In this interface, camera will be set to be the SHOOT_PHOTO mode
|
||||
|
||||
@ -664,6 +664,7 @@ void DjiTest_FlightControlSetGetParamSample()
|
||||
E_DjiFlightControllerRtkPositionEnableStatus rtkEnableStatus;
|
||||
E_DjiFlightControllerRCLostAction rcLostAction;
|
||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||
uint16_t countryCode;
|
||||
|
||||
returnCode = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -673,6 +674,12 @@ void DjiTest_FlightControlSetGetParamSample()
|
||||
USER_LOG_INFO("Flight control set-get-param sample start");
|
||||
DjiTest_WidgetLogAppend("Flight control set-get-param sample start");
|
||||
|
||||
returnCode = DjiFlightController_GetCountryCode(&countryCode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get aircraft country code error.");
|
||||
}
|
||||
USER_LOG_INFO("country code: %hd", countryCode);
|
||||
|
||||
/*! Turn on horizontal vision avoid enable */
|
||||
USER_LOG_INFO("--> Step 1: Turn on horizontal visual obstacle avoidance");
|
||||
DjiTest_WidgetLogAppend("--> Step 1: Turn on horizontal visual obstacle avoidance");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -212,7 +212,7 @@ static T_DjiReturnCode DjiTest_HmsManagerInit(void)
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
snprintf(tempFileDirPath, HMS_DIR_PATH_LEN_MAX, "%s/data/hms_2023_08_22.json", curFileDirPath);
|
||||
snprintf(tempFileDirPath, HMS_DIR_PATH_LEN_MAX, "%s/data/hms.json", curFileDirPath);
|
||||
|
||||
returnCode = UtilFile_GetFileSizeByPath(tempFileDirPath, &fileSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
|
||||
@ -47,31 +47,20 @@ static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path,
|
||||
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
char curFileDirPath[DJI_FILE_PATH_SIZE_MAX];
|
||||
char tempFileDirPath[DJI_FILE_PATH_SIZE_MAX];
|
||||
|
||||
if (path == NULL) {
|
||||
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, DJI_FILE_PATH_SIZE_MAX,
|
||||
curFileDirPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
snprintf(tempFileDirPath, DJI_FILE_PATH_SIZE_MAX, "%s/dji_sdk_config.json",
|
||||
curFileDirPath);
|
||||
} else {
|
||||
strcpy(tempFileDirPath, path);
|
||||
perror("Config file path is null.\n");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
printf("Load configuration start.\r\n");
|
||||
printf("Load configuration start, config file path is: %s\r\n", path);
|
||||
|
||||
returnCode = DjiUserConfigManager_GetAppInfoInner(tempFileDirPath, &s_configManagerUserInfo);
|
||||
returnCode = DjiUserConfigManager_GetAppInfoInner(path, &s_configManagerUserInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
perror("Get app info failed.\n");
|
||||
}
|
||||
|
||||
returnCode = DjiUserConfigManager_GetLinkConfigInner(tempFileDirPath, &s_configManagerLinkInfo);
|
||||
returnCode = DjiUserConfigManager_GetLinkConfigInner(path, &s_configManagerLinkInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
perror("Get link info failed.\n");
|
||||
}
|
||||
@ -133,7 +122,8 @@ static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_
|
||||
|
||||
jsonRoot = cJSON_Parse((char *) jsonData);
|
||||
if (jsonRoot == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
returnCode = DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
goto jsonDataFree;
|
||||
}
|
||||
|
||||
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_app_info");
|
||||
@ -176,7 +166,8 @@ static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_
|
||||
strlen(userInfo->developerAccount) >= sizeof(userInfo->developerAccount) ||
|
||||
strlen(userInfo->baudRate) > sizeof(userInfo->baudRate)) {
|
||||
USER_LOG_ERROR("Length of user information string is beyond limit. Please check.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
returnCode = DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
goto jsonDataFree;
|
||||
}
|
||||
|
||||
if (!strcmp(userInfo->appName, "your_app_name") ||
|
||||
@ -187,9 +178,11 @@ static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_
|
||||
!strcmp(userInfo->baudRate, "your_baud_rate")) {
|
||||
USER_LOG_ERROR(
|
||||
"Please fill in correct user information to 'samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.json' file.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
returnCode = DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
goto jsonDataFree;
|
||||
}
|
||||
|
||||
jsonDataFree:
|
||||
osalHandler->Free(jsonData);
|
||||
#endif
|
||||
|
||||
@ -42,6 +42,7 @@ static T_DjiWaypointV3MissionState s_lastWaypointV3MissionState = {0};
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_WaypointV3MissionStateCallback(T_DjiWaypointV3MissionState missionState);
|
||||
static T_DjiReturnCode DjiTest_WaypointV3ActionStateCallback(T_DjiWaypointV3ActionState actionState);
|
||||
static T_DjiReturnCode DjiTest_WaypointV3WaitEndFlightStatus(T_DjiFcSubscriptionFlightStatus status);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_WaypointV3RunSample(void)
|
||||
@ -136,8 +137,6 @@ T_DjiReturnCode DjiTest_WaypointV3RunSample(void)
|
||||
goto close_file;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
close_file:
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
returnCode = fclose(kmzFile);
|
||||
@ -155,21 +154,49 @@ close_file:
|
||||
goto out;
|
||||
}
|
||||
|
||||
do {
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
USER_LOG_INFO("The aircraft is on the ground and motors are stoped...");
|
||||
returnCode = DjiTest_WaypointV3WaitEndFlightStatus(DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_STOPED);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Wait end flight status error.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
|
||||
(uint8_t *) &flightStatus,
|
||||
sizeof(T_DjiFcSubscriptionFlightStatus),
|
||||
&flightStatusTimestamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get value of topic flight status failed, error code:0x%08llX", returnCode);
|
||||
}
|
||||
USER_LOG_INFO("The aircraft is on the ground and motors are rotating...");
|
||||
returnCode = DjiTest_WaypointV3WaitEndFlightStatus(DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_ON_GROUND);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Wait end flight status error.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("flight status: %d", flightStatus);
|
||||
} while(flightStatus == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR);
|
||||
USER_LOG_INFO("The aircraft is in the air...");
|
||||
returnCode = DjiTest_WaypointV3WaitEndFlightStatus(DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Wait end flight status error.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The aircraft is on the ground now.");
|
||||
USER_LOG_INFO("The aircraft is on the ground and motors are rotating...");
|
||||
returnCode = DjiTest_WaypointV3WaitEndFlightStatus(DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_ON_GROUND);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Wait end flight status error.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
|
||||
(uint8_t *) &flightStatus,
|
||||
sizeof(T_DjiFcSubscriptionFlightStatus),
|
||||
&flightStatusTimestamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get value of topic flight status failed, error code:0x%08llX", returnCode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (flightStatus != DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_STOPED) {
|
||||
USER_LOG_ERROR("Aircraft's flight status error, motors are not stoped.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The aircraft is on the ground now, and motor are stoped.");
|
||||
|
||||
out:
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
@ -209,4 +236,25 @@ static T_DjiReturnCode DjiTest_WaypointV3ActionStateCallback(T_DjiWaypointV3Acti
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_WaypointV3WaitEndFlightStatus(T_DjiFcSubscriptionFlightStatus status) {
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
T_DjiDataTimestamp flightStatusTimestamp = {0};
|
||||
T_DjiFcSubscriptionFlightStatus flightStatus = 0;
|
||||
|
||||
do {
|
||||
osalHandler->TaskSleepMs(20);
|
||||
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
|
||||
(uint8_t *)&flightStatus,
|
||||
sizeof(T_DjiFcSubscriptionFlightStatus),
|
||||
&flightStatusTimestamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get value of topic flight status failed, error code:0x%08llX", returnCode);
|
||||
}
|
||||
} while(flightStatus == status);
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
|
||||
@ -87,12 +87,11 @@ typedef enum {
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_TAP_ZOOM = 20,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_OPTICAL_ZOOM = 21,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_SINGLE_PHOTO = 22,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_AEB_PHOTO = 23,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_BURST_PHOTO = 24,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_INTERVAL_PHOTO = 25,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_RECORDER_VIDEO = 26,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_MEDIA_DOWNLOAD = 27,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_THERMOMETRY = 28,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_BURST_PHOTO = 23,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_INTERVAL_PHOTO = 24,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_RECORDER_VIDEO = 25,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_MEDIA_DOWNLOAD = 26,
|
||||
E_DJI_SAMPLE_INDEX_CAMMGR_THERMOMETRY = 27,
|
||||
E_DJI_SAMPLE_INDEX_UNKNOWN = 0xFF,
|
||||
} E_DjiExtensionPortSampleIndex;
|
||||
|
||||
@ -583,10 +582,6 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
||||
DjiTest_CameraManagerRunSample(s_mountPosition,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_SINGLE_PHOTO);
|
||||
break;
|
||||
case E_DJI_SAMPLE_INDEX_CAMMGR_AEB_PHOTO:
|
||||
DjiTest_CameraManagerRunSample(s_mountPosition,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_AEB_PHOTO);
|
||||
break;
|
||||
case E_DJI_SAMPLE_INDEX_CAMMGR_BURST_PHOTO:
|
||||
DjiTest_CameraManagerRunSample(s_mountPosition,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_BURST_PHOTO);
|
||||
|
||||
@ -205,22 +205,19 @@
|
||||
"item_name": "23_test_cammgr-single_photo"
|
||||
},
|
||||
{
|
||||
"item_name": "24_test_cammgr-AEB_photo"
|
||||
"item_name": "24_test_cammgr-burst_photo"
|
||||
},
|
||||
{
|
||||
"item_name": "25_test_cammgr-burst_photo"
|
||||
"item_name": "25_test_cammgr-interval_photo"
|
||||
},
|
||||
{
|
||||
"item_name": "26_test_cammgr-interval_photo"
|
||||
"item_name": "26_test_cammgr-recorder_video"
|
||||
},
|
||||
{
|
||||
"item_name": "27_test_cammgr-recorder_video"
|
||||
"item_name": "27_test_cammgr-media_download"
|
||||
},
|
||||
{
|
||||
"item_name": "28_test_cammgr-media_download"
|
||||
},
|
||||
{
|
||||
"item_name": "29_test_cammgr-thermometry"
|
||||
"item_name": "28_test_cammgr-thermometry"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -205,22 +205,19 @@
|
||||
"item_name": "23_test_cammgr-single_photo"
|
||||
},
|
||||
{
|
||||
"item_name": "24_test_cammgr-AEB_photo"
|
||||
"item_name": "24_test_cammgr-burst_photo"
|
||||
},
|
||||
{
|
||||
"item_name": "25_test_cammgr-burst_photo"
|
||||
"item_name": "25_test_cammgr-interval_photo"
|
||||
},
|
||||
{
|
||||
"item_name": "26_test_cammgr-interval_photo"
|
||||
"item_name": "26_test_cammgr-recorder_video"
|
||||
},
|
||||
{
|
||||
"item_name": "27_test_cammgr-recorder_video"
|
||||
"item_name": "27_test_cammgr-media_download"
|
||||
},
|
||||
{
|
||||
"item_name": "28_test_cammgr-media_download"
|
||||
},
|
||||
{
|
||||
"item_name": "29_test_cammgr-thermometry"
|
||||
"item_name": "28_test_cammgr-thermometry"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -75,6 +75,9 @@ T_DjiReturnCode Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), uin
|
||||
|
||||
T_DjiReturnCode Osal_TaskDestroy(T_DjiTaskHandle task)
|
||||
{
|
||||
if (task == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
pthread_cancel(*(pthread_t *) task);
|
||||
free(task);
|
||||
|
||||
@ -344,4 +347,4 @@ void Osal_Free(void *ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
|
||||
@ -143,7 +143,7 @@ int main(int argc, char **argv)
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get aircraft version info error");
|
||||
} else {
|
||||
USER_LOG_INFO("Aircraft version is V%d.%d.%d.%d", aircraftInfoVersion.majorVersion,
|
||||
USER_LOG_INFO("Aircraft version is V%02d.%02d.%02d.%02d", aircraftInfoVersion.majorVersion,
|
||||
aircraftInfoVersion.minorVersion, aircraftInfoVersion.modifyVersion,
|
||||
aircraftInfoVersion.debugVersion);
|
||||
}
|
||||
|
||||
@ -141,9 +141,9 @@ int main(int argc, char **argv)
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get aircraft version info error");
|
||||
} else {
|
||||
USER_LOG_INFO("Aircraft version is V%d.%d.%d.%d", aircraftInfoVersion.debugVersion,
|
||||
aircraftInfoVersion.modifyVersion, aircraftInfoVersion.minorVersion,
|
||||
aircraftInfoVersion.majorVersion);
|
||||
USER_LOG_INFO("Aircraft version is V%02d.%02d.%02d.%02d", aircraftInfoVersion.majorVersion,
|
||||
aircraftInfoVersion.minorVersion, aircraftInfoVersion.modifyVersion,
|
||||
aircraftInfoVersion.debugVersion);
|
||||
}
|
||||
|
||||
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
||||
|
||||
@ -62,6 +62,11 @@ extern "C" {
|
||||
|
||||
//#endif
|
||||
|
||||
#define USER_FIRMWARE_MAJOR_VERSION (1)
|
||||
#define USER_FIRMWARE_MINOR_VERSION (33)
|
||||
#define USER_FIRMWARE_MODIFY_VERSION (88)
|
||||
#define USER_FIRMWARE_DEBUG_VERSION (99)
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
@ -410,6 +410,11 @@
|
||||
</File>
|
||||
<File>
|
||||
<FileType>1</FileType>
|
||||
<FileName>dji_config_manager.c</FileName>
|
||||
<FilePath>..\..\..\..\..\module_sample\utils\dji_config_manager.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileType>1</FileType>
|
||||
<FileName>file_binary_array_list_en.c</FileName>
|
||||
<FilePath>..\..\..\..\..\module_sample\widget\file_binary_array_list_en.c</FilePath>
|
||||
</File>
|
||||
|
||||
Reference in New Issue
Block a user