NEW: release DJI Payload-SDK version 3.5
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
@ -316,7 +316,7 @@ The following portions of the DJI’s Payload SDK (“Software” referred to in
|
|||||||
│ │ │ │ ├── hal_uart.h
|
│ │ │ │ ├── hal_uart.h
|
||||||
│ │ │ │ ├── hal_usb_bulk.c
|
│ │ │ │ ├── hal_usb_bulk.c
|
||||||
│ │ │ │ └── hal_usb_bulk.h
|
│ │ │ │ └── hal_usb_bulk.h
|
||||||
│ │ │ └── nvidia_jeston
|
│ │ │ └── nvidia_jetson
|
||||||
│ │ │ ├── application
|
│ │ │ ├── application
|
||||||
│ │ │ │ ├── dji_sdk_app_info.h
|
│ │ │ │ ├── dji_sdk_app_info.h
|
||||||
│ │ │ │ ├── dji_sdk_config.h
|
│ │ │ │ ├── dji_sdk_config.h
|
||||||
@ -497,7 +497,7 @@ The following portions of the DJI’s Payload SDK (“Software” referred to in
|
|||||||
│ │ ├── hal_uart.h
|
│ │ ├── hal_uart.h
|
||||||
│ │ ├── hal_usb_bulk.c
|
│ │ ├── hal_usb_bulk.c
|
||||||
│ │ └── hal_usb_bulk.h
|
│ │ └── hal_usb_bulk.h
|
||||||
│ └── nvidia_jeston
|
│ └── nvidia_jetson
|
||||||
│ ├── application
|
│ ├── application
|
||||||
│ │ ├── application.cpp
|
│ │ ├── application.cpp
|
||||||
│ │ ├── application.hpp
|
│ │ ├── application.hpp
|
||||||
|
47
README.md
47
README.md
@ -1,6 +1,6 @@
|
|||||||
# DJI Payload SDK (PSDK)
|
# DJI Payload SDK (PSDK)
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
@ -23,37 +23,22 @@ to get the latest version information.
|
|||||||
|
|
||||||
## Latest Release
|
## Latest Release
|
||||||
|
|
||||||
PSDK 3.4.0 was released on 18 April 2023. This version of Payload SDK mainly add some new features support and fixed
|
PSDK 3.5.0 was released on 18 May 2023. This version of Payload SDK mainly add support for M350 RTK, also add some new features support and fixed some bugs.
|
||||||
some bugs. Please refer to the release notes for detailed changes list.
|
Please refer to the release notes for detailed changes list.
|
||||||
|
|
||||||
* Added support for SDK interconnection on M30/M30T
|
* Added support for new drone model Matrice 350 RTK
|
||||||
* Added support for downloading camera media files on M3E/M3T
|
* Matrice 300 RTK added support for DJI RC Plus
|
||||||
* Added support for infrared temperature in camera management on M30T/M3T
|
* Added support for downloading media files in pieces on all drone models
|
||||||
* Added support for waypoint action status push on M30/M30T and M3E/M3T
|
* Added support for Osal get random number callback interface on all drone model
|
||||||
* Added support for custom HMS function on all models
|
* Fixed issue with the black screen problem when uses third-party camera to playback video on M300 RTK and DJI smart controller screen combination
|
||||||
* Added support for custom device version number and serial number on all models
|
* Fixed issue with failure of subscribing L1 camera code stream on M300 RTK
|
||||||
* Added support for subscribing to video stream request I-frame on all models
|
* Fixed issue with failure of subscribing main camera code stream in dual control mode on M300 RTK
|
||||||
* Added support for obtaining H20N laser distance measurement data camera management on M300 RTK
|
* Fixed issue with local upgrade function of RTOS platform on Mavic 3E/3T
|
||||||
* Added support for controlling H20N infrared zoom in camera management on M300 RTK
|
* Fixed issue with the initialization failure of using PSDK Payload device and millimeter wave radar on M300 RTK
|
||||||
* Added support for subscribing perception grayscale image by Ethernet on M30/M30T and M3E/M3T
|
* Fixed issue with custom HMS function on M300 RTK and X-Port combination
|
||||||
* Added support for downloading camera media files by Ethernet on M30/M30T and M3E/M3T
|
* Fixed issue with invalid TTS option of speaker widget on M300 RTK
|
||||||
* Added support for Nvidia Jeston series development boards sample
|
* Fixed issue with downloading file list with high probability of failure when the camera photos are over 400 on M300 RTK
|
||||||
* Added support for H20/H20T model files
|
* Fixed some of the memory leaks
|
||||||
* Fixed issue with unsuccessful initialization in USB single Bulk mode on M30/M30T and M3E/M3T
|
|
||||||
* Fixed issue with unstable data transmission OSDK expansion port to PSDK port for passing through small data on M300 RTK
|
|
||||||
* Fixed issue with third-party camera function causing payload disconnection due to deleting all media files in certain platforms on M300 RTK
|
|
||||||
* Fixed issue with gimbal mode abnormal setting in gimbal management on M300 RTK
|
|
||||||
* Fixed issue with deleting L1 camera media files in camera management on M300 RTK
|
|
||||||
* Fixed issue with abnormal triggering of text input box widget function in RTOS platform on M300 RTK
|
|
||||||
* Fixed issue with abnormal payload power supply during hot plugging in some scenarios in RTOS platform on M3E/M3T
|
|
||||||
* Fixed issue with CPU loading abnormal usage due to multiple video stream subscriptions on M30/M30T
|
|
||||||
* Fixed issue with occasional payload negotiation failure on M30/M30T and M3E/M3T
|
|
||||||
* Fixed issue with obtaining camera work mode on M30/M30T and M3E/M3T
|
|
||||||
* Fixed issue with obtaining camera zoom parameters on M30/M30T and M3E/M3T
|
|
||||||
* Fixed issue with altitude and distance limitations when using joystick function in some scenarios on all models
|
|
||||||
* Fixed some memory leak issues
|
|
||||||
* Optimized camera management C++ Sample support
|
|
||||||
* Optimized gimbal management C++ Sample support
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -442,6 +442,12 @@ typedef enum {
|
|||||||
DJI_CAMERA_MANAGER_RECORDING_CONTROL_RESUME = 3,
|
DJI_CAMERA_MANAGER_RECORDING_CONTROL_RESUME = 3,
|
||||||
} E_DjiCameraManagerRecordingControl;
|
} E_DjiCameraManagerRecordingControl;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_FILE_LIST_COUNT_60_PER_SLICE = 60,
|
||||||
|
DJI_CAMERA_MANAGER_FILE_LIST_COUNT_120_PER_SLICE = 120,
|
||||||
|
DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE = 0xFFFF,
|
||||||
|
} E_DjiCameraManagerFileListCountPerSlice;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t firmware_version[4];
|
uint8_t firmware_version[4];
|
||||||
} T_DjiCameraManagerFirmwareVersion;
|
} T_DjiCameraManagerFirmwareVersion;
|
||||||
@ -500,6 +506,11 @@ typedef struct {
|
|||||||
T_DjiCameraManagerFileListInfo *fileListInfo;
|
T_DjiCameraManagerFileListInfo *fileListInfo;
|
||||||
} T_DjiCameraManagerFileList;
|
} T_DjiCameraManagerFileList;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t sliceStartIndex;
|
||||||
|
E_DjiCameraManagerFileListCountPerSlice countPerSlice;
|
||||||
|
} T_DjiCameraManagerSliceConfig;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DJI_DOWNLOAD_FILE_EVENT_START,
|
DJI_DOWNLOAD_FILE_EVENT_START,
|
||||||
DJI_DOWNLOAD_FILE_EVENT_TRANSFER,
|
DJI_DOWNLOAD_FILE_EVENT_TRANSFER,
|
||||||
@ -1011,6 +1022,18 @@ T_DjiReturnCode DjiCameraManager_StopRecordVideo(E_DjiMountPosition position);
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiCameraManager_DownloadFileList(E_DjiMountPosition position, T_DjiCameraManagerFileList *fileList);
|
T_DjiReturnCode DjiCameraManager_DownloadFileList(E_DjiMountPosition position, T_DjiCameraManagerFileList *fileList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Download selected camera media file list by slices.
|
||||||
|
* @note The interface is a synchronous interface, which occupies more CPU resources when using it.
|
||||||
|
* If the download file fails, the timeout time is 3S.
|
||||||
|
* @param position: the mount position of the camera
|
||||||
|
* @param sliceConfig: the slices config for downloading file list
|
||||||
|
* @param fileList: the pointer to the downloaded camera file list
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_DownloadFileListBySlices(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerSliceConfig sliceConfig,
|
||||||
|
T_DjiCameraManagerFileList *fileList);
|
||||||
/**
|
/**
|
||||||
* @brief Regsiter selected camera download file data callback,
|
* @brief Regsiter selected camera download file data callback,
|
||||||
* @param position: the mount position of the camera
|
* @param position: the mount position of the camera
|
||||||
|
@ -361,8 +361,8 @@ typedef enum {
|
|||||||
DJI_FC_SUBSCRIPTION_TOPIC_STATUS_MOTOR_START_ERROR = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC,
|
DJI_FC_SUBSCRIPTION_TOPIC_STATUS_MOTOR_START_ERROR = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC,
|
||||||
31),
|
31),
|
||||||
/*!
|
/*!
|
||||||
* @brief Battery information topic name. Please refer to ::T_DjiFcSubscriptionBatteryInfo for information about data structure.
|
* @brief Battery information topic name. Please refer to ::T_DjiFcSubscriptionWholeBatteryInfo for information about data structure.
|
||||||
* @datastruct \ref T_DjiFcSubscriptionBatteryInfo
|
* @datastruct \ref T_DjiFcSubscriptionWholeBatteryInfo
|
||||||
*/
|
*/
|
||||||
DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC, 32),
|
DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC, 32),
|
||||||
/*!
|
/*!
|
||||||
@ -981,7 +981,7 @@ typedef struct BatterySingleInfo {
|
|||||||
int32_t currentElectric; /*!< uint: mA. */
|
int32_t currentElectric; /*!< uint: mA. */
|
||||||
uint32_t fullCapacity; /*!< uint: mAh. */
|
uint32_t fullCapacity; /*!< uint: mAh. */
|
||||||
uint32_t remainedCapacity; /*!< uint: mAh. */
|
uint32_t remainedCapacity; /*!< uint: mAh. */
|
||||||
int16_t batteryTemperature; /*!< uint:℃. */
|
int16_t batteryTemperature; /*!< uint: 0.1℃. */
|
||||||
uint8_t cellCount;
|
uint8_t cellCount;
|
||||||
uint8_t batteryCapacityPercent; /*!< uint: %. */
|
uint8_t batteryCapacityPercent; /*!< uint: %. */
|
||||||
T_DjiFcSubscriptionSingleBatteryState batteryState;
|
T_DjiFcSubscriptionSingleBatteryState batteryState;
|
||||||
|
@ -76,7 +76,6 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DJI_FLIGHT_CONTROLLER_ENABLE_EMERGENCY_STOP_MOTOR = 0x01, /*!< Execute emergency-stop-motor action */
|
DJI_FLIGHT_CONTROLLER_ENABLE_EMERGENCY_STOP_MOTOR = 0x01, /*!< Execute emergency-stop-motor action */
|
||||||
DJI_FLIGHT_CONTROLLER_DISABLE_EMERGENCY_STOP_MOTOR = 0x02 /*!< Cancel emergency-stop-motor status */
|
|
||||||
} E_DjiFlightControllerEmergencyStopMotor;
|
} E_DjiFlightControllerEmergencyStopMotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,11 +89,14 @@ typedef enum {
|
|||||||
* Baud rate support list on M300 RTK Extension Port: 115200, 230400, 460800, 921600, 1000000.
|
* Baud rate support list on M300 RTK Extension Port: 115200, 230400, 460800, 921600, 1000000.
|
||||||
* Baud rate support list on M30/M30T: 115200, 230400, 460800, 921600, 1000000.
|
* Baud rate support list on M30/M30T: 115200, 230400, 460800, 921600, 1000000.
|
||||||
* Baud rate support list on M3E/M3T: 921600.
|
* Baud rate support list on M3E/M3T: 921600.
|
||||||
|
* Baud rate support list on M350 RTK Payload Port: 115200, 230400, 460800, 921600.
|
||||||
|
* Baud rate support list on M350 RTK Extension Port: 115200, 230400, 460800, 921600, 1000000.
|
||||||
* */
|
* */
|
||||||
DJI_HAL_UART_NUM_0,
|
DJI_HAL_UART_NUM_0,
|
||||||
/**
|
/**
|
||||||
* Only support on M300 RTK Extension Port by USB virtual serial port, such as /dev/ttyACM0.
|
* Only support on M300/M350 RTK Extension Port by USB virtual serial port, such as /dev/ttyACM0.
|
||||||
* Baud rate support list on M300 RTK Extension Port: 921600.
|
* Baud rate support list on M300 RTK Extension Port: 921600.
|
||||||
|
* Baud rate support list on M350 RTK Extension Port: 921600.
|
||||||
* */
|
* */
|
||||||
DJI_HAL_UART_NUM_1,
|
DJI_HAL_UART_NUM_1,
|
||||||
} E_DjiHalUartNum;
|
} E_DjiHalUartNum;
|
||||||
@ -221,6 +224,8 @@ typedef struct {
|
|||||||
|
|
||||||
T_DjiReturnCode (*GetTimeUs)(uint64_t *us);
|
T_DjiReturnCode (*GetTimeUs)(uint64_t *us);
|
||||||
|
|
||||||
|
T_DjiReturnCode (*GetRandomNum)(uint16_t *randomNum);
|
||||||
|
|
||||||
void *(*Malloc)(uint32_t size);
|
void *(*Malloc)(uint32_t size);
|
||||||
|
|
||||||
void (*Free)(void *ptr);
|
void (*Free)(void *ptr);
|
||||||
|
@ -71,6 +71,12 @@ typedef T_DjiReturnCode (*DjiPowerOffNotificationCallback)(bool *powerOffPrepara
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiPowerManagement_Init(void);
|
T_DjiReturnCode DjiPowerManagement_Init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DeInitialise power management module, and user should call this function before using power management features.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiPowerManagement_DeInit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Apply high power from aircraft in blocking mode.
|
* @brief Apply high power from aircraft in blocking mode.
|
||||||
* @details Before applying, user should register callback function used to set level state of high power application
|
* @details Before applying, user should register callback function used to set level state of high power application
|
||||||
|
@ -83,7 +83,7 @@ typedef enum {
|
|||||||
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 = 1,
|
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 = 1,
|
||||||
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 = 2,
|
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 = 2,
|
||||||
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3 = 3,
|
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3 = 3,
|
||||||
DJI_MOUNT_POSITION_EXTENSION_PORT = 4
|
DJI_MOUNT_POSITION_EXTENSION_PORT = 4,
|
||||||
} E_DjiMountPosition;
|
} E_DjiMountPosition;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -92,6 +92,7 @@ typedef enum {
|
|||||||
DJI_AIRCRAFT_SERIES_M300 = 2,
|
DJI_AIRCRAFT_SERIES_M300 = 2,
|
||||||
DJI_AIRCRAFT_SERIES_M30 = 3,
|
DJI_AIRCRAFT_SERIES_M30 = 3,
|
||||||
DJI_AIRCRAFT_SERIES_M3 = 4,
|
DJI_AIRCRAFT_SERIES_M3 = 4,
|
||||||
|
DJI_AIRCRAFT_SERIES_M350 = 5,
|
||||||
} E_DjiAircraftSeries;
|
} E_DjiAircraftSeries;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -104,6 +105,7 @@ typedef enum {
|
|||||||
DJI_AIRCRAFT_TYPE_M30T = 68, /*!< Aircraft type is Matrice 30T. */
|
DJI_AIRCRAFT_TYPE_M30T = 68, /*!< Aircraft type is Matrice 30T. */
|
||||||
DJI_AIRCRAFT_TYPE_M3E = 77, /*!< Aircraft type is Mavic 3E. */
|
DJI_AIRCRAFT_TYPE_M3E = 77, /*!< Aircraft type is Mavic 3E. */
|
||||||
DJI_AIRCRAFT_TYPE_M3T = 79, /*!< Aircraft type is Mavic 3T. */
|
DJI_AIRCRAFT_TYPE_M3T = 79, /*!< Aircraft type is Mavic 3T. */
|
||||||
|
DJI_AIRCRAFT_TYPE_M350_RTK = 89, /*!< Aircraft type is Matrice 350 RTK. */
|
||||||
} E_DjiAircraftType;
|
} E_DjiAircraftType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,10 +34,10 @@ extern "C" {
|
|||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
#define DJI_VERSION_MAJOR 3 /*!< DJI SDK major version num, when have incompatible API changes. Range from 0 to 99. */
|
#define DJI_VERSION_MAJOR 3 /*!< DJI SDK major version num, when have incompatible API changes. Range from 0 to 99. */
|
||||||
#define DJI_VERSION_MINOR 4 /*!< DJI SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
|
#define DJI_VERSION_MINOR 5 /*!< DJI SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
|
||||||
#define DJI_VERSION_MODIFY 0 /*!< DJI SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
|
#define DJI_VERSION_MODIFY 0 /*!< DJI SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
|
||||||
#define DJI_VERSION_BETA 0 /*!< DJI SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
|
#define DJI_VERSION_BETA 0 /*!< DJI SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
|
||||||
#define DJI_VERSION_BUILD 1749 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */
|
#define DJI_VERSION_BUILD 1764 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -50,6 +50,7 @@ static const char *s_cameraManagerSampleSelectList[] = {
|
|||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_INTERVAL_PHOTO] = "Shoot interval 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 |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RECORD_VIDEO] = "Record video |",
|
||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_AND_DELETE_MEDIA_FILE] = "Download and delete media file |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_AND_DELETE_MEDIA_FILE] = "Download and delete media file |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_FILE_LIST_BY_SLICES] = "Download file list by slices |",
|
||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY] = "Thermometry test |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY] = "Thermometry test |",
|
||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO] = "Get lidar ranging info |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO] = "Get lidar ranging info |",
|
||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM] = "Set ir camera zoom param |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM] = "Set ir camera zoom param |",
|
||||||
@ -120,8 +121,7 @@ void DjiUser_RunCameraManagerSample(void)
|
|||||||
if (posNum > 3 || posNum < 1) {
|
if (posNum > 3 || posNum < 1) {
|
||||||
USER_LOG_ERROR("Input mount position is invalid");
|
USER_LOG_ERROR("Input mount position is invalid");
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ start:
|
|||||||
if (mountPosition == 'q') {
|
if (mountPosition == 'q') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mountPosition > '3' || mountPosition < '1') {
|
if (mountPosition > '3' || mountPosition < '1') {
|
||||||
USER_LOG_ERROR("Input mount position is invalid");
|
USER_LOG_ERROR("Input mount position is invalid");
|
||||||
goto start;
|
goto start;
|
||||||
|
@ -49,3 +49,4 @@ void DjiUser_RunGimbalManagerSample(void);
|
|||||||
|
|
||||||
#endif // TEST_GIMBAL_ENTRY_H
|
#endif // TEST_GIMBAL_ENTRY_H
|
||||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
|
|
||||||
|
@ -358,13 +358,6 @@ static void *DjiTest_StereoImagesDisplayTask(void *arg)
|
|||||||
pack->gotData = false;
|
pack->gotData = false;
|
||||||
osalHandler->MutexUnlock(pack->mutex);
|
osalHandler->MutexUnlock(pack->mutex);
|
||||||
|
|
||||||
/*! Using Opencv display here */
|
|
||||||
if (strstr(nameStr, "_l")) {
|
|
||||||
cv::moveWindow(nameStr, 200, 0);
|
|
||||||
} else {
|
|
||||||
cv::moveWindow(nameStr, (200 + (int) pack->info.rawInfo.width), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < USER_PERCEPTION_DIRECTION_NUM) {
|
if (i < USER_PERCEPTION_DIRECTION_NUM) {
|
||||||
/*! Calculate frame rate */
|
/*! Calculate frame rate */
|
||||||
timeNow[i] = (double) cv::getTickCount();
|
timeNow[i] = (double) cv::getTickCount();
|
||||||
|
@ -98,6 +98,10 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
|||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
*mutex = malloc(sizeof(pthread_mutex_t));
|
*mutex = malloc(sizeof(pthread_mutex_t));
|
||||||
if (*mutex == NULL) {
|
if (*mutex == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||||
@ -118,7 +122,11 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
int result;
|
int result = 0;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
result = pthread_mutex_destroy(mutex);
|
result = pthread_mutex_destroy(mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
@ -136,8 +144,13 @@ T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
int result = pthread_mutex_lock(mutex);
|
int result = 0;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = pthread_mutex_lock(mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -152,8 +165,13 @@ T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
int result = pthread_mutex_unlock(mutex);
|
int result = 0;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = pthread_mutex_unlock(mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -308,6 +326,14 @@ T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum)
|
||||||
|
{
|
||||||
|
srand(time(NULL));
|
||||||
|
*randomNum = random() % 65535;
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void *Osal_Malloc(uint32_t size)
|
void *Osal_Malloc(uint32_t size)
|
||||||
{
|
{
|
||||||
return malloc(size);
|
return malloc(size);
|
||||||
|
@ -65,6 +65,7 @@ T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore);
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
||||||
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
||||||
|
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum);
|
||||||
|
|
||||||
void *Osal_Malloc(uint32_t size);
|
void *Osal_Malloc(uint32_t size);
|
||||||
void Osal_Free(void *ptr);
|
void Osal_Free(void *ptr);
|
||||||
|
@ -72,7 +72,8 @@ T_DjiReturnCode Osal_Socket(E_DjiSocketMode mode, T_DjiSocketHandle *socketHandl
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setsockopt(socketHandleStruct->socketFd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, optlen) < 0) {
|
if (setsockopt(socketHandleStruct->socketFd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, optlen) < 0)
|
||||||
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else if (mode == DJI_SOCKET_MODE_TCP) {
|
} else if (mode == DJI_SOCKET_MODE_TCP) {
|
||||||
@ -86,7 +87,6 @@ T_DjiReturnCode Osal_Socket(E_DjiSocketMode mode, T_DjiSocketHandle *socketHandl
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
close(socketHandleStruct->socketFd);
|
close(socketHandleStruct->socketFd);
|
||||||
free(socketHandleStruct);
|
free(socketHandleStruct);
|
||||||
|
|
||||||
|
@ -2,15 +2,24 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(dji_sdk_demo_linux_cxx CXX)
|
project(dji_sdk_demo_linux_cxx CXX)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
||||||
set(CMAKE_C_COMPILER "gcc")
|
set(CMAKE_C_COMPILER "gcc")
|
||||||
set(CMAKE_CXX_COMPILER "g++")
|
set(CMAKE_CXX_COMPILER "g++")
|
||||||
add_definitions(-D_GNU_SOURCE)
|
add_definitions(-D_GNU_SOURCE)
|
||||||
|
|
||||||
|
if (MEMORY_LEAK_CHECK_ON MATCHES TRUE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
||||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_CXX_FLAGS} -fprofile-arcs -ftest-coverage -Wno-deprecated-declarations")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -Wno-deprecated-declarations")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||||
|
endif ()
|
||||||
|
|
||||||
include_directories(../../../module_sample)
|
include_directories(../../../module_sample)
|
||||||
include_directories(../../../../sample_c/module_sample)
|
include_directories(../../../../sample_c/module_sample)
|
||||||
|
@ -77,14 +77,14 @@ Application::~Application()
|
|||||||
void Application::DjiUser_SetupEnvironment()
|
void Application::DjiUser_SetupEnvironment()
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiOsalHandler osalHandler;
|
T_DjiOsalHandler osalHandler = {0};
|
||||||
T_DjiHalUartHandler uartHandler;
|
T_DjiHalUartHandler uartHandler = {0};
|
||||||
T_DjiHalUsbBulkHandler usbBulkHandler;
|
T_DjiHalUsbBulkHandler usbBulkHandler = {0};
|
||||||
T_DjiLoggerConsole printConsole;
|
T_DjiLoggerConsole printConsole;
|
||||||
T_DjiLoggerConsole localRecordConsole;
|
T_DjiLoggerConsole localRecordConsole;
|
||||||
T_DjiFileSystemHandler fileSystemHandler;
|
T_DjiFileSystemHandler fileSystemHandler = {0};
|
||||||
T_DjiSocketHandler socketHandler;
|
T_DjiSocketHandler socketHandler {0};
|
||||||
T_DjiHalNetworkHandler networkHandler;
|
T_DjiHalNetworkHandler networkHandler = {0};
|
||||||
|
|
||||||
networkHandler.NetworkInit = HalNetWork_Init;
|
networkHandler.NetworkInit = HalNetWork_Init;
|
||||||
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
||||||
@ -117,6 +117,7 @@ void Application::DjiUser_SetupEnvironment()
|
|||||||
osalHandler.Free = Osal_Free;
|
osalHandler.Free = Osal_Free;
|
||||||
osalHandler.GetTimeMs = Osal_GetTimeMs;
|
osalHandler.GetTimeMs = Osal_GetTimeMs;
|
||||||
osalHandler.GetTimeUs = Osal_GetTimeUs;
|
osalHandler.GetTimeUs = Osal_GetTimeUs;
|
||||||
|
osalHandler.GetRandomNum = Osal_GetRandomNum;
|
||||||
|
|
||||||
printConsole.func = DjiUser_PrintConsole;
|
printConsole.func = DjiUser_PrintConsole;
|
||||||
printConsole.consoleLevel = DJI_LOGGER_CONSOLE_LOG_LEVEL_INFO;
|
printConsole.consoleLevel = DJI_LOGGER_CONSOLE_LOG_LEVEL_INFO;
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <hms/test_hms.h>
|
#include <hms/test_hms.h>
|
||||||
#include <waypoint_v2/test_waypoint_v2.h>
|
#include <waypoint_v2/test_waypoint_v2.h>
|
||||||
#include <waypoint_v3/test_waypoint_v3.h>
|
#include <waypoint_v3/test_waypoint_v3.h>
|
||||||
#include <gimbal_manager/test_gimbal_manager.h>
|
|
||||||
#include "application.hpp"
|
#include "application.hpp"
|
||||||
#include "fc_subscription/test_fc_subscription.h"
|
#include "fc_subscription/test_fc_subscription.h"
|
||||||
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
||||||
|
@ -62,17 +62,19 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
|||||||
#ifdef LIBUSB_INSTALLED
|
#ifdef LIBUSB_INSTALLED
|
||||||
ret = libusb_init(NULL);
|
ret = libusb_init(NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
USER_LOG_ERROR("init usb bulk failed, errno = %d", ret);
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
||||||
if(handle == NULL) {
|
if(handle == NULL) {
|
||||||
|
USER_LOG_ERROR("open usb device failed");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = libusb_claim_interface(handle, usbBulkInfo.channelInfo.interfaceNum);
|
ret = libusb_claim_interface(handle, usbBulkInfo.channelInfo.interfaceNum);
|
||||||
if (ret != LIBUSB_SUCCESS) {
|
if (ret != LIBUSB_SUCCESS) {
|
||||||
printf("libusb claim interface error");
|
USER_LOG_ERROR("libusb claim interface failed, errno = %d", ret);
|
||||||
libusb_close(handle);
|
libusb_close(handle);
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -115,6 +117,7 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
|||||||
{
|
{
|
||||||
struct libusb_device_handle *handle = NULL;
|
struct libusb_device_handle *handle = NULL;
|
||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
int32_t ret;
|
||||||
|
|
||||||
if (usbBulkHandle == NULL) {
|
if (usbBulkHandle == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
@ -124,8 +127,11 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
|||||||
|
|
||||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||||
#ifdef LIBUSB_INSTALLED
|
#ifdef LIBUSB_INSTALLED
|
||||||
libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
ret = libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||||
osalHandler->TaskSleepMs(100);
|
if(ret != 0) {
|
||||||
|
USER_LOG_ERROR("release usb bulk interface failed, errno = %d", ret);
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
|
}
|
||||||
libusb_exit(NULL);
|
libusb_exit(NULL);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(dji_sdk_demo_on_jeston_cxx CXX)
|
project(dji_sdk_demo_on_jetson_cxx CXX)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
||||||
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
|
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
|
||||||
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
|
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
|
||||||
add_definitions(-D_GNU_SOURCE)
|
add_definitions(-D_GNU_SOURCE)
|
||||||
|
|
||||||
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
||||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -Wno-deprecated-declarations")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_CXX_FLAGS} -fprofile-arcs -ftest-coverage -Wno-deprecated-declarations")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||||
endif ()
|
endif ()
|
||||||
@ -17,7 +17,7 @@ endif ()
|
|||||||
include_directories(../../../module_sample)
|
include_directories(../../../module_sample)
|
||||||
include_directories(../../../../sample_c/module_sample)
|
include_directories(../../../../sample_c/module_sample)
|
||||||
include_directories(../common)
|
include_directories(../common)
|
||||||
include_directories(../nvidia_jeston/application)
|
include_directories(../nvidia_jetson/application)
|
||||||
|
|
||||||
file(GLOB_RECURSE MODULE_SAMPLE_SRC
|
file(GLOB_RECURSE MODULE_SAMPLE_SRC
|
||||||
../../../module_sample/liveview/*.c*
|
../../../module_sample/liveview/*.c*
|
||||||
@ -57,8 +57,10 @@ if (OpenCV_FOUND)
|
|||||||
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
||||||
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
||||||
add_definitions(-DOPEN_CV_VERSION_3)
|
add_definitions(-DOPEN_CV_VERSION_3)
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
add_definitions(-DOPEN_CV_VERSION_4)
|
add_definitions(-DOPEN_CV_VERSION_4)
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||||
@ -69,8 +71,6 @@ if (FFMPEG_FOUND)
|
|||||||
message(STATUS "Found FFMPEG installed in the system")
|
message(STATUS "Found FFMPEG installed in the system")
|
||||||
message(STATUS " - Includes: ${FFMPEG_INCLUDE_DIR}")
|
message(STATUS " - Includes: ${FFMPEG_INCLUDE_DIR}")
|
||||||
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
|
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
|
||||||
add_definitions(-DFFMPEG_INSTALLED)
|
|
||||||
include_directories(${FFMPEG_INCLUDE_DIR})
|
|
||||||
|
|
||||||
EXECUTE_PROCESS(COMMAND ffmpeg -version
|
EXECUTE_PROCESS(COMMAND ffmpeg -version
|
||||||
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
|
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
|
||||||
@ -87,6 +87,8 @@ if (FFMPEG_FOUND)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${FFMPEG_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} ${FFMPEG_LIBRARIES})
|
||||||
|
include_directories(${FFMPEG_INCLUDE_DIR})
|
||||||
|
add_definitions(-DFFMPEG_INSTALLED)
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "Cannot Find FFMPEG")
|
message(STATUS "Cannot Find FFMPEG")
|
||||||
endif (FFMPEG_FOUND)
|
endif (FFMPEG_FOUND)
|
@ -77,14 +77,14 @@ Application::~Application()
|
|||||||
void Application::DjiUser_SetupEnvironment()
|
void Application::DjiUser_SetupEnvironment()
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiOsalHandler osalHandler;
|
T_DjiOsalHandler osalHandler = {0};
|
||||||
T_DjiHalUartHandler uartHandler;
|
T_DjiHalUartHandler uartHandler = {0};
|
||||||
T_DjiHalUsbBulkHandler usbBulkHandler;
|
T_DjiHalUsbBulkHandler usbBulkHandler = {0};
|
||||||
T_DjiLoggerConsole printConsole;
|
T_DjiLoggerConsole printConsole;
|
||||||
T_DjiLoggerConsole localRecordConsole;
|
T_DjiLoggerConsole localRecordConsole;
|
||||||
T_DjiFileSystemHandler fileSystemHandler;
|
T_DjiFileSystemHandler fileSystemHandler = {0};
|
||||||
T_DjiSocketHandler socketHandler;
|
T_DjiSocketHandler socketHandler = {0};
|
||||||
T_DjiHalNetworkHandler networkHandler;
|
T_DjiHalNetworkHandler networkHandler = {0};
|
||||||
|
|
||||||
networkHandler.NetworkInit = HalNetWork_Init;
|
networkHandler.NetworkInit = HalNetWork_Init;
|
||||||
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
||||||
@ -117,6 +117,7 @@ void Application::DjiUser_SetupEnvironment()
|
|||||||
osalHandler.Free = Osal_Free;
|
osalHandler.Free = Osal_Free;
|
||||||
osalHandler.GetTimeMs = Osal_GetTimeMs;
|
osalHandler.GetTimeMs = Osal_GetTimeMs;
|
||||||
osalHandler.GetTimeUs = Osal_GetTimeUs;
|
osalHandler.GetTimeUs = Osal_GetTimeUs;
|
||||||
|
osalHandler.GetRandomNum = Osal_GetRandomNum,
|
||||||
|
|
||||||
printConsole.func = DjiUser_PrintConsole;
|
printConsole.func = DjiUser_PrintConsole;
|
||||||
printConsole.consoleLevel = DJI_LOGGER_CONSOLE_LOG_LEVEL_INFO;
|
printConsole.consoleLevel = DJI_LOGGER_CONSOLE_LOG_LEVEL_INFO;
|
@ -186,7 +186,8 @@ T_DjiReturnCode DjiTest_CameraEmuMediaStartService(void)
|
|||||||
|
|
||||||
UtilBuffer_Init(&s_mediaPlayCommandBufferHandler, s_mediaPlayCommandBuffer, sizeof(s_mediaPlayCommandBuffer));
|
UtilBuffer_Init(&s_mediaPlayCommandBufferHandler, s_mediaPlayCommandBuffer, sizeof(s_mediaPlayCommandBuffer));
|
||||||
|
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK) {
|
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK) {
|
||||||
returnCode = DjiPayloadCamera_RegMediaDownloadPlaybackHandler(&s_psdkCameraMedia);
|
returnCode = DjiPayloadCamera_RegMediaDownloadPlaybackHandler(&s_psdkCameraMedia);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("psdk camera media function init error.");
|
USER_LOG_ERROR("psdk camera media function init error.");
|
||||||
|
@ -72,6 +72,7 @@ static uint32_t s_nextDownloadFileIndex = 0;
|
|||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
static uint8_t DjiTest_CameraManagerGetCameraTypeIndex(E_DjiCameraType cameraType);
|
static uint8_t DjiTest_CameraManagerGetCameraTypeIndex(E_DjiCameraType cameraType);
|
||||||
static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_DjiMountPosition position);
|
static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_DjiMountPosition position);
|
||||||
|
static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiMountPosition position);
|
||||||
static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownloadFilePacketInfo packetInfo,
|
static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownloadFilePacketInfo packetInfo,
|
||||||
const uint8_t *data, uint16_t len);
|
const uint8_t *data, uint16_t len);
|
||||||
static T_DjiReturnCode DjiTest_CameraManagerGetAreaThermometryData(E_DjiMountPosition position);
|
static T_DjiReturnCode DjiTest_CameraManagerGetAreaThermometryData(E_DjiMountPosition position);
|
||||||
@ -1071,8 +1072,8 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
"error code: 0x%08X\r\n", mountPosition, returnCode);
|
"error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
goto exitCameraModule;
|
goto exitCameraModule;
|
||||||
}
|
}
|
||||||
USER_LOG_INFO("Sleep 4s...");
|
USER_LOG_INFO("Sleep 8s...");
|
||||||
osalHandler->TaskSleepMs(4000);
|
osalHandler->TaskSleepMs(8000);
|
||||||
|
|
||||||
returnCode = DjiTest_CameraManagerOpticalZoom(mountPosition, DJI_CAMERA_ZOOM_DIRECTION_OUT, 5);
|
returnCode = DjiTest_CameraManagerOpticalZoom(mountPosition, DJI_CAMERA_ZOOM_DIRECTION_OUT, 5);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -1195,6 +1196,15 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_FILE_LIST_BY_SLICES: {
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
DjiTest_CameraManagerMediaDownloadFileListBySlices(mountPosition);
|
||||||
|
#else
|
||||||
|
USER_LOG_WARN("This feature does not support RTOS platform.");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY: {
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY: {
|
||||||
returnCode = DjiTest_CameraManagerGetPointThermometryData(mountPosition);
|
returnCode = DjiTest_CameraManagerGetPointThermometryData(mountPosition);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -1353,6 +1363,77 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiMountPosition position)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
uint16_t downloadCount = 0;
|
||||||
|
T_DjiCameraManagerSliceConfig sliceConfig = {0};
|
||||||
|
|
||||||
|
s_nextDownloadFileIndex = 0;
|
||||||
|
returnCode = DjiCameraManager_RegDownloadFileDataCallback(position, DjiTest_CameraManagerDownloadFileDataCallback);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Register download file data callback failed, error code: 0x%08X.", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
sliceConfig.countPerSlice = DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE;
|
||||||
|
sliceConfig.sliceStartIndex = 0;
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_DownloadFileListBySlices(position, sliceConfig, &s_meidaFileList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Download file list failed, error code: 0x%08X.", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_meidaFileList.totalCount > 0) {
|
||||||
|
downloadCount = s_meidaFileList.totalCount;
|
||||||
|
printf(
|
||||||
|
"\033[1;33;40m -> Download file list finished, total 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) {
|
||||||
|
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,
|
||||||
|
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,
|
||||||
|
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),
|
||||||
|
s_meidaFileList.fileListInfo[i].type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_DownloadFileByIndex(position, s_meidaFileList.fileListInfo[0].fileIndex);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Download media file by index failed, error code: 0x%08X.", returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownloadFilePacketInfo packetInfo,
|
static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownloadFilePacketInfo packetInfo,
|
||||||
const uint8_t *data, uint16_t len)
|
const uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
@ -1371,7 +1452,8 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
|
|||||||
|
|
||||||
memset(downloadFileName, 0, sizeof(downloadFileName));
|
memset(downloadFileName, 0, sizeof(downloadFileName));
|
||||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s", s_meidaFileList.fileListInfo[i].fileName);
|
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);
|
USER_LOG_INFO("Start download media file, index : %d, next download media file, index: %d", i,
|
||||||
|
s_nextDownloadFileIndex);
|
||||||
s_downloadMediaFile = fopen(downloadFileName, "wb+");
|
s_downloadMediaFile = fopen(downloadFileName, "wb+");
|
||||||
if (s_downloadMediaFile == NULL) {
|
if (s_downloadMediaFile == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
|
@ -52,6 +52,7 @@ typedef enum {
|
|||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_INTERVAL_PHOTO,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_INTERVAL_PHOTO,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RECORD_VIDEO,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RECORD_VIDEO,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_AND_DELETE_MEDIA_FILE,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_AND_DELETE_MEDIA_FILE,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_FILE_LIST_BY_SLICES,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM,
|
||||||
|
@ -60,7 +60,6 @@ T_DjiReturnCode DjiTest_DataTransmissionStartService(void)
|
|||||||
char ipAddr[DJI_IP_ADDR_STR_SIZE_MAX];
|
char ipAddr[DJI_IP_ADDR_STR_SIZE_MAX];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
|
||||||
|
|
||||||
djiStat = DjiLowSpeedDataChannel_Init();
|
djiStat = DjiLowSpeedDataChannel_Init();
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("init data transmission module error.");
|
USER_LOG_ERROR("init data transmission module error.");
|
||||||
@ -124,6 +123,25 @@ T_DjiReturnCode DjiTest_DataTransmissionStartService(void)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiTest_DataTransmissionStopService(void)
|
||||||
|
{
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
|
||||||
|
if (osalHandler->TaskDestroy(s_userDataTransmissionThread) != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("user data transmission task destroy error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiLowSpeedDataChannel_DeInit();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("deinit data transmission module error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
#ifndef __CC_ARM
|
#ifndef __CC_ARM
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
@ -41,6 +41,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
T_DjiReturnCode DjiTest_DataTransmissionStartService(void);
|
T_DjiReturnCode DjiTest_DataTransmissionStartService(void);
|
||||||
|
T_DjiReturnCode DjiTest_DataTransmissionStopService(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ T_DjiReturnCode DjiTest_FcSubscriptionRunSample(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 2: Subscribe the topics of quaternion, velocity and gps position");
|
USER_LOG_INFO("--> Step 2: Subscribe the topics of quaternion, velocity and gps position");
|
||||||
djiStat = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, DJI_DATA_SUBSCRIPTION_TOPIC_1_HZ,
|
djiStat = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
|
||||||
DjiTest_FcSubscriptionReceiveQuaternionCallback);
|
DjiTest_FcSubscriptionReceiveQuaternionCallback);
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Subscribe topic quaternion error.");
|
USER_LOG_ERROR("Subscribe topic quaternion error.");
|
||||||
|
@ -186,7 +186,10 @@ T_DjiReturnCode DjiTest_FlightControlInit(void)
|
|||||||
DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
|
DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
} else if (returnCode == DJI_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_DUPLICATE) {
|
||||||
|
USER_LOG_WARN("Subscribe topic quaternion duplicate");
|
||||||
|
} else {
|
||||||
USER_LOG_ERROR("Subscribe topic quaternion failed,error code:0x%08llX", returnCode);
|
USER_LOG_ERROR("Subscribe topic quaternion failed,error code:0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
@ -703,7 +706,8 @@ void DjiTest_FlightControlSetGetParamSample()
|
|||||||
DjiTest_WidgetLogAppend("--> Step 3: Turn on horizontal radar obstacle avoidance");
|
DjiTest_WidgetLogAppend("--> Step 3: Turn on horizontal radar obstacle avoidance");
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK) {
|
||||||
returnCode = DjiFlightController_SetHorizontalRadarObstacleAvoidanceEnableStatus(
|
returnCode = DjiFlightController_SetHorizontalRadarObstacleAvoidanceEnableStatus(
|
||||||
DJI_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE);
|
DJI_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -717,7 +721,8 @@ void DjiTest_FlightControlSetGetParamSample()
|
|||||||
DjiTest_WidgetLogAppend("--> Step 4: Get horizontal radar obstacle avoidance status\r\n");
|
DjiTest_WidgetLogAppend("--> Step 4: Get horizontal radar obstacle avoidance status\r\n");
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK) {
|
||||||
returnCode = DjiFlightController_GetHorizontalRadarObstacleAvoidanceEnableStatus(
|
returnCode = DjiFlightController_GetHorizontalRadarObstacleAvoidanceEnableStatus(
|
||||||
&horizontalRadarObstacleAvoidanceStatus);
|
&horizontalRadarObstacleAvoidanceStatus);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -756,7 +761,8 @@ void DjiTest_FlightControlSetGetParamSample()
|
|||||||
DjiTest_WidgetLogAppend("--> Step 7: Turn on upwards radar obstacle avoidance.");
|
DjiTest_WidgetLogAppend("--> Step 7: Turn on upwards radar obstacle avoidance.");
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK) {
|
||||||
returnCode = DjiFlightController_SetUpwardsRadarObstacleAvoidanceEnableStatus(
|
returnCode = DjiFlightController_SetUpwardsRadarObstacleAvoidanceEnableStatus(
|
||||||
DJI_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE);
|
DJI_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -770,7 +776,8 @@ void DjiTest_FlightControlSetGetParamSample()
|
|||||||
DjiTest_WidgetLogAppend("--> Step 8: Get upwards radar obstacle avoidance status\r\n");
|
DjiTest_WidgetLogAppend("--> Step 8: Get upwards radar obstacle avoidance status\r\n");
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK) {
|
||||||
returnCode = DjiFlightController_GetUpwardsRadarObstacleAvoidanceEnableStatus(
|
returnCode = DjiFlightController_GetUpwardsRadarObstacleAvoidanceEnableStatus(
|
||||||
&upwardsRadarObstacleAvoidanceStatus);
|
&upwardsRadarObstacleAvoidanceStatus);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -846,7 +853,8 @@ void DjiTest_FlightControlSetGetParamSample()
|
|||||||
s_osalHandler->TaskSleepMs(1000);
|
s_osalHandler->TaskSleepMs(1000);
|
||||||
|
|
||||||
/*! Set rc lost action */
|
/*! Set rc lost action */
|
||||||
if (aircraftInfoBaseInfo.aircraftType != DJI_AIRCRAFT_TYPE_M300_RTK) {
|
if (aircraftInfoBaseInfo.aircraftType != DJI_AIRCRAFT_TYPE_M300_RTK &&
|
||||||
|
aircraftInfoBaseInfo.aircraftType != DJI_AIRCRAFT_TYPE_M350_RTK) {
|
||||||
USER_LOG_INFO("--> Step 15: Set rc lost action");
|
USER_LOG_INFO("--> Step 15: Set rc lost action");
|
||||||
DjiTest_WidgetLogAppend("--> Step 15: Set rc lost action");
|
DjiTest_WidgetLogAppend("--> Step 15: Set rc lost action");
|
||||||
returnCode = DjiFlightController_SetRCLostAction(DJI_FLIGHT_CONTROLLER_RC_LOST_ACTION_GOHOME);
|
returnCode = DjiFlightController_SetRCLostAction(DJI_FLIGHT_CONTROLLER_RC_LOST_ACTION_GOHOME);
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#define PAYLOAD_GIMBAL_EMU_TASK_STACK_SIZE (2048)
|
#define PAYLOAD_GIMBAL_EMU_TASK_STACK_SIZE (2048)
|
||||||
#define PAYLOAD_GIMBAL_TASK_FREQ 1000
|
#define PAYLOAD_GIMBAL_TASK_FREQ 1000
|
||||||
#define PAYLOAD_GIMBAL_CALIBRATION_TIME_MS 2000
|
#define PAYLOAD_GIMBAL_CALIBRATION_TIME_MS 2000
|
||||||
|
#define PAYLOAD_GIMBAL_MIN_ACTION_TIME 5
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
/* Private types -------------------------------------------------------------*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -389,11 +390,15 @@ static void *UserGimbal_Task(void *arg)
|
|||||||
|
|
||||||
djiStat = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, DJI_DATA_SUBSCRIPTION_TOPIC_10_HZ,
|
djiStat = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, DJI_DATA_SUBSCRIPTION_TOPIC_10_HZ,
|
||||||
NULL);
|
NULL);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
if (djiStat == DJI_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_DUPLICATE) {
|
if (djiStat == DJI_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_DUPLICATE) {
|
||||||
USER_LOG_DEBUG("Subscribe topic quaternion duplicate.");
|
USER_LOG_WARN("Subscribe topic quaternion duplicate.");
|
||||||
} else if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
} else {
|
||||||
USER_LOG_ERROR("Subscribe topic quaternion error.");
|
USER_LOG_ERROR("Subscribe topic quaternion error.");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
USER_LOG_DEBUG("Subscribe topic quaternion success.");
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
osalHandler->TaskSleepMs(1000 / PAYLOAD_GIMBAL_TASK_FREQ);
|
osalHandler->TaskSleepMs(1000 / PAYLOAD_GIMBAL_TASK_FREQ);
|
||||||
@ -1077,6 +1082,11 @@ DjiTest_GimbalCalculateSpeed(T_DjiAttitude3d originalAttitude, T_DjiAttitude3d t
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actionTime == 0) {
|
||||||
|
USER_LOG_WARN("Input action time is zero, now used max speed to rotate.");
|
||||||
|
actionTime = PAYLOAD_GIMBAL_MIN_ACTION_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
pitchSpeedTemp = (float) (targetAttitude.pitch - originalAttitude.pitch) / (float) actionTime * 100;
|
pitchSpeedTemp = (float) (targetAttitude.pitch - originalAttitude.pitch) / (float) actionTime * 100;
|
||||||
rollSpeedTemp = (float) (targetAttitude.roll - originalAttitude.roll) / (float) actionTime * 100;
|
rollSpeedTemp = (float) (targetAttitude.roll - originalAttitude.roll) / (float) actionTime * 100;
|
||||||
yawSpeedTemp = (float) (targetAttitude.yaw - originalAttitude.yaw) / (float) actionTime * 100;
|
yawSpeedTemp = (float) (targetAttitude.yaw - originalAttitude.yaw) / (float) actionTime * 100;
|
||||||
|
@ -151,6 +151,4 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||||
|
@ -52,6 +52,7 @@ static const char *oldReplaceComponentIndexStr = "%component_index";
|
|||||||
static T_DjiHmsFileBinaryArray s_EnHmsTextConfigFileBinaryArrayList[] = {
|
static T_DjiHmsFileBinaryArray s_EnHmsTextConfigFileBinaryArrayList[] = {
|
||||||
{hms_text_config_json_fileName, hms_text_config_json_fileSize, hms_text_config_json_fileBinaryArray},
|
{hms_text_config_json_fileName, hms_text_config_json_fileSize, hms_text_config_json_fileBinaryArray},
|
||||||
};
|
};
|
||||||
|
static bool s_hmsServiceRunFlag = false;
|
||||||
|
|
||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
static T_DjiReturnCode DjiTest_HmsInit(void);
|
static T_DjiReturnCode DjiTest_HmsInit(void);
|
||||||
@ -169,6 +170,8 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
|||||||
DjiHms_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
DjiHms_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
s_hmsServiceRunFlag = true;
|
||||||
|
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +196,10 @@ static T_DjiReturnCode DjiTest_HmsInit(void)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s_hmsServiceRunFlag == true) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
return DjiHms_Init();
|
return DjiHms_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +214,10 @@ static T_DjiReturnCode DjiTest_HmsDeInit(void)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s_hmsServiceRunFlag == true) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
return DjiHms_DeInit();
|
return DjiHms_DeInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ T_DjiReturnCode DjiTest_PowerManagementStartService(void)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK &&
|
if ((baseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
|
baseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK) &&
|
||||||
(baseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_SKYPORT_V2 ||
|
(baseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_SKYPORT_V2 ||
|
||||||
baseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_XPORT)) {
|
baseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_XPORT)) {
|
||||||
// apply high power
|
// apply high power
|
||||||
@ -130,6 +131,19 @@ T_DjiReturnCode DjiTest_PowerManagementStartService(void)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiTest_PowerManagementStopService(void)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
|
||||||
|
returnCode = DjiPowerManagement_DeInit();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("power management deinit error: 0x%08llX.", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
static T_DjiReturnCode DjiTest_PowerOffNotificationCallback(bool *powerOffPreparationFlag)
|
static T_DjiReturnCode DjiTest_PowerOffNotificationCallback(bool *powerOffPreparationFlag)
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,7 @@ typedef struct {
|
|||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
T_DjiReturnCode DjiTest_PowerManagementStartService(void);
|
T_DjiReturnCode DjiTest_PowerManagementStartService(void);
|
||||||
|
T_DjiReturnCode DjiTest_PowerManagementStopService(void);
|
||||||
T_DjiReturnCode DjiTest_RegApplyHighPowerHandler(T_DjiTestApplyHighPowerHandler *applyHighPowerHandler);
|
T_DjiReturnCode DjiTest_RegApplyHighPowerHandler(T_DjiTestApplyHighPowerHandler *applyHighPowerHandler);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "dji_logger.h"
|
#include "dji_logger.h"
|
||||||
#include "dji_waypoint_v3.h"
|
#include "dji_waypoint_v3.h"
|
||||||
#include "waypoint_file_c/waypoint_v3_test_file_kmz.h"
|
#include "waypoint_file_c/waypoint_v3_test_file_kmz.h"
|
||||||
|
#include "dji_fc_subscription.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
#define DJI_TEST_WAYPOINT_V3_KMZ_FILE_PATH_LEN_MAX (256)
|
#define DJI_TEST_WAYPOINT_V3_KMZ_FILE_PATH_LEN_MAX (256)
|
||||||
@ -47,6 +48,9 @@ T_DjiReturnCode DjiTest_WaypointV3RunSample(void)
|
|||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
T_DjiFcSubscriptionFlightStatus flightStatus = 0;
|
||||||
|
T_DjiDataTimestamp flightStatusTimestamp = {0};
|
||||||
|
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
FILE *kmzFile = NULL;
|
FILE *kmzFile = NULL;
|
||||||
uint32_t kmzFileSize = 0;
|
uint32_t kmzFileSize = 0;
|
||||||
@ -94,25 +98,25 @@ T_DjiReturnCode DjiTest_WaypointV3RunSample(void)
|
|||||||
returnCode = UtilFile_GetFileSize(kmzFile, &kmzFileSize);
|
returnCode = UtilFile_GetFileSize(kmzFile, &kmzFileSize);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Get kmz file size failed.");
|
USER_LOG_ERROR("Get kmz file size failed.");
|
||||||
goto out;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmzFileBuf = osalHandler->Malloc(kmzFileSize);
|
kmzFileBuf = osalHandler->Malloc(kmzFileSize);
|
||||||
if (kmzFileBuf == NULL) {
|
if (kmzFileBuf == NULL) {
|
||||||
USER_LOG_ERROR("Malloc kmz file buf error.");
|
USER_LOG_ERROR("Malloc kmz file buf error.");
|
||||||
goto out;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
readLen = fread(kmzFileBuf, 1, kmzFileSize, kmzFile);
|
readLen = fread(kmzFileBuf, 1, kmzFileSize, kmzFile);
|
||||||
if (readLen != kmzFileSize) {
|
if (readLen != kmzFileSize) {
|
||||||
USER_LOG_ERROR("Read kmz file data failed.");
|
USER_LOG_ERROR("Read kmz file data failed.");
|
||||||
goto out;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnCode = DjiWaypointV3_UploadKmzFile(kmzFileBuf, kmzFileSize);
|
returnCode = DjiWaypointV3_UploadKmzFile(kmzFileBuf, kmzFileSize);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Upload kmz file failed.");
|
USER_LOG_ERROR("Upload kmz file failed.");
|
||||||
goto out;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
osalHandler->Free(kmzFileBuf);
|
osalHandler->Free(kmzFileBuf);
|
||||||
@ -129,14 +133,43 @@ T_DjiReturnCode DjiTest_WaypointV3RunSample(void)
|
|||||||
returnCode = DjiWaypointV3_Action(DJI_WAYPOINT_V3_ACTION_START);
|
returnCode = DjiWaypointV3_Action(DJI_WAYPOINT_V3_ACTION_START);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Execute start action failed.");
|
USER_LOG_ERROR("Execute start action failed.");
|
||||||
|
goto close_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
close_file:
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
returnCode = fclose(kmzFile);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Close KMZ file failed.");
|
||||||
|
}
|
||||||
|
kmzFile = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
|
||||||
|
DJI_DATA_SUBSCRIPTION_TOPIC_10_HZ,
|
||||||
|
NULL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Subscribe topic flight status failed, error code:0x%08llX", returnCode);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
do {
|
||||||
fclose(kmzFile);
|
osalHandler->TaskSleepMs(2000);
|
||||||
#endif
|
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
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("flight status: %d", flightStatus);
|
||||||
|
} while(flightStatus == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR);
|
||||||
|
|
||||||
|
USER_LOG_INFO("The aircraft is on the ground now.");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
@ -145,7 +178,7 @@ out:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DjiWaypointV3_DeInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
@ -163,6 +163,7 @@ T_DjiReturnCode DjiTest_WidgetSpeakerStartService(void)
|
|||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
|
||||||
static uint32_t DjiTest_GetVoicePlayProcessId(void)
|
static uint32_t DjiTest_GetVoicePlayProcessId(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -220,21 +221,21 @@ static T_DjiReturnCode DjiTest_DecodeAudioData(void)
|
|||||||
/*! Attention: you can use "ffmpeg -i xxx.mp3 -ar 16000 -ac 1 out.wav" and use opus-tools to generate opus file for test */
|
/*! Attention: you can use "ffmpeg -i xxx.mp3 -ar 16000 -ac 1 out.wav" and use opus-tools to generate opus file for test */
|
||||||
fin = fopen(WIDGET_SPEAKER_AUDIO_OPUS_FILE_NAME, "r");
|
fin = fopen(WIDGET_SPEAKER_AUDIO_OPUS_FILE_NAME, "r");
|
||||||
if (fin == NULL) {
|
if (fin == NULL) {
|
||||||
USER_LOG_ERROR("failed to open input file: %s\n", strerror(errno));
|
fprintf(stderr, "failed to open input file: %s\n", strerror(errno));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fout = fopen(WIDGET_SPEAKER_AUDIO_PCM_FILE_NAME, "w");
|
|
||||||
if (fout == NULL) {
|
|
||||||
USER_LOG_ERROR("failed to open output file: %s\n", strerror(errno));
|
|
||||||
goto open_pcm_audio_failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a new decoder state. */
|
/* Create a new decoder state. */
|
||||||
decoder = opus_decoder_create(WIDGET_SPEAKER_AUDIO_OPUS_SAMPLE_RATE, WIDGET_SPEAKER_AUDIO_OPUS_CHANNELS, &err);
|
decoder = opus_decoder_create(WIDGET_SPEAKER_AUDIO_OPUS_SAMPLE_RATE, WIDGET_SPEAKER_AUDIO_OPUS_CHANNELS, &err);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
USER_LOG_ERROR("failed to create decoder: %s\n", opus_strerror(err));
|
fprintf(stderr, "failed to create decoder: %s\n", opus_strerror(err));
|
||||||
goto create_decoder_failed;
|
goto close_fin;
|
||||||
|
}
|
||||||
|
|
||||||
|
fout = fopen(WIDGET_SPEAKER_AUDIO_PCM_FILE_NAME, "w");
|
||||||
|
if (fout == NULL) {
|
||||||
|
fprintf(stderr, "failed to open output file: %s\n", strerror(errno));
|
||||||
|
goto close_fin;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -254,8 +255,8 @@ static T_DjiReturnCode DjiTest_DecodeAudioData(void)
|
|||||||
the frame size returned. */
|
the frame size returned. */
|
||||||
frame_size = opus_decode(decoder, cbits, nbBytes, out, WIDGET_SPEAKER_AUDIO_OPUS_MAX_FRAME_SIZE, 0);
|
frame_size = opus_decode(decoder, cbits, nbBytes, out, WIDGET_SPEAKER_AUDIO_OPUS_MAX_FRAME_SIZE, 0);
|
||||||
if (frame_size < 0) {
|
if (frame_size < 0) {
|
||||||
USER_LOG_ERROR("decoder failed: %s\n", opus_strerror(frame_size));
|
fprintf(stderr, "decoder failed: %s\n", opus_strerror(frame_size));
|
||||||
goto decode_data_failed;
|
goto close_fout;
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_DEBUG("decode data to file: %d\r\n", frame_size * WIDGET_SPEAKER_AUDIO_OPUS_CHANNELS);
|
USER_LOG_DEBUG("decode data to file: %d\r\n", frame_size * WIDGET_SPEAKER_AUDIO_OPUS_CHANNELS);
|
||||||
@ -278,8 +279,18 @@ create_decoder_failed:
|
|||||||
open_pcm_audio_failed:
|
open_pcm_audio_failed:
|
||||||
fclose(fin);
|
fclose(fin);
|
||||||
#endif
|
#endif
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
|
#ifdef OPUS_INSTALLED
|
||||||
|
close_fout:
|
||||||
|
fclose(fout);
|
||||||
|
|
||||||
|
close_fin:
|
||||||
|
fclose(fin);
|
||||||
|
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode DjiTest_PlayAudioData(void)
|
static T_DjiReturnCode DjiTest_PlayAudioData(void)
|
||||||
@ -364,7 +375,7 @@ static T_DjiReturnCode DjiTest_CheckFileMd5Sum(const char *path, uint8_t *buf, u
|
|||||||
uint32_t readFileTotalSize = 0;
|
uint32_t readFileTotalSize = 0;
|
||||||
uint16_t readLen;
|
uint16_t readLen;
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
uint8_t readBuf[1024];
|
uint8_t readBuf[1024] = {0};
|
||||||
uint8_t md5Sum[16] = {0};
|
uint8_t md5Sum[16] = {0};
|
||||||
FILE *file = NULL;;
|
FILE *file = NULL;;
|
||||||
|
|
||||||
@ -407,6 +418,7 @@ static T_DjiReturnCode DjiTest_CheckFileMd5Sum(const char *path, uint8_t *buf, u
|
|||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void SetSpeakerState(E_DjiWidgetSpeakerState speakerState)
|
static void SetSpeakerState(E_DjiWidgetSpeakerState speakerState)
|
||||||
@ -628,6 +640,7 @@ static T_DjiReturnCode ReceiveTtsData(E_DjiWidgetTransmitDataEvent event,
|
|||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
if (s_ttsFile != NULL) {
|
if (s_ttsFile != NULL) {
|
||||||
fclose(s_ttsFile);
|
fclose(s_ttsFile);
|
||||||
|
s_ttsFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnCode = DjiTest_CheckFileMd5Sum(WIDGET_SPEAKER_TTS_FILE_NAME, buf, size);
|
returnCode = DjiTest_CheckFileMd5Sum(WIDGET_SPEAKER_TTS_FILE_NAME, buf, size);
|
||||||
@ -685,6 +698,7 @@ static T_DjiReturnCode ReceiveAudioData(E_DjiWidgetTransmitDataEvent event,
|
|||||||
USER_LOG_INFO("Close voice file.");
|
USER_LOG_INFO("Close voice file.");
|
||||||
if (s_audioFile != NULL) {
|
if (s_audioFile != NULL) {
|
||||||
fclose(s_audioFile);
|
fclose(s_audioFile);
|
||||||
|
s_audioFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
@ -55,6 +55,13 @@
|
|||||||
#define WIDGET_LOG_STRING_MAX_SIZE (40)
|
#define WIDGET_LOG_STRING_MAX_SIZE (40)
|
||||||
#define WIDGET_LOG_LINE_MAX_NUM (5)
|
#define WIDGET_LOG_LINE_MAX_NUM (5)
|
||||||
|
|
||||||
|
#define DJI_HMS_ERROR_CODE_VALUE0 0x1E020000
|
||||||
|
#define DJI_HMS_ERROR_CODE_VALUE1 0x1E020001
|
||||||
|
#define DJI_HMS_ERROR_CODE_VALUE2 0x1E020002
|
||||||
|
#define DJI_HMS_ERROR_CODE_VALUE3 0x1E020003
|
||||||
|
#define DJI_HMS_ERROR_CODE_VALUE4 0x1E020004
|
||||||
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
/* Private types -------------------------------------------------------------*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
E_DJI_SAMPLE_INDEX_FC_SUBSCRIPTION = 0,
|
E_DJI_SAMPLE_INDEX_FC_SUBSCRIPTION = 0,
|
||||||
@ -86,7 +93,6 @@ typedef enum {
|
|||||||
E_DJI_SAMPLE_INDEX_CAMMGR_RECORDER_VIDEO = 26,
|
E_DJI_SAMPLE_INDEX_CAMMGR_RECORDER_VIDEO = 26,
|
||||||
E_DJI_SAMPLE_INDEX_CAMMGR_MEDIA_DOWNLOAD = 27,
|
E_DJI_SAMPLE_INDEX_CAMMGR_MEDIA_DOWNLOAD = 27,
|
||||||
E_DJI_SAMPLE_INDEX_CAMMGR_THERMOMETRY = 28,
|
E_DJI_SAMPLE_INDEX_CAMMGR_THERMOMETRY = 28,
|
||||||
|
|
||||||
E_DJI_SAMPLE_INDEX_UNKNOWN = 0xFF,
|
E_DJI_SAMPLE_INDEX_UNKNOWN = 0xFF,
|
||||||
} E_DjiExtensionPortSampleIndex;
|
} E_DjiExtensionPortSampleIndex;
|
||||||
|
|
||||||
@ -376,19 +382,19 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
|||||||
if (s_isInjectErrcode == true && s_isEliminateErrcode == false) {
|
if (s_isInjectErrcode == true && s_isEliminateErrcode == false) {
|
||||||
switch (s_extensionPortErrcodeIndex) {
|
switch (s_extensionPortErrcodeIndex) {
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX1:
|
case E_DJI_HMS_ERROR_CODE_INDEX1:
|
||||||
errorCode = 0x1E020000;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE0;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX2:
|
case E_DJI_HMS_ERROR_CODE_INDEX2:
|
||||||
errorCode = 0x1E020001;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE1;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX3:
|
case E_DJI_HMS_ERROR_CODE_INDEX3:
|
||||||
errorCode = 0x1E020002;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE2;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX4:
|
case E_DJI_HMS_ERROR_CODE_INDEX4:
|
||||||
errorCode = 0x1E020003;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE3;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX5:
|
case E_DJI_HMS_ERROR_CODE_INDEX5:
|
||||||
errorCode = 0x1E020004;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -421,19 +427,19 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
|||||||
if (s_isEliminateErrcode == true && s_isInjectErrcode == false) {
|
if (s_isEliminateErrcode == true && s_isInjectErrcode == false) {
|
||||||
switch (s_extensionPortErrcodeIndex) {
|
switch (s_extensionPortErrcodeIndex) {
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX1:
|
case E_DJI_HMS_ERROR_CODE_INDEX1:
|
||||||
errorCode = 0x1E020000;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE0;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX2:
|
case E_DJI_HMS_ERROR_CODE_INDEX2:
|
||||||
errorCode = 0x1E020001;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE1;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX3:
|
case E_DJI_HMS_ERROR_CODE_INDEX3:
|
||||||
errorCode = 0x1E020002;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE2;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX4:
|
case E_DJI_HMS_ERROR_CODE_INDEX4:
|
||||||
errorCode = 0x1E020003;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE3;
|
||||||
break;
|
break;
|
||||||
case E_DJI_HMS_ERROR_CODE_INDEX5:
|
case E_DJI_HMS_ERROR_CODE_INDEX5:
|
||||||
errorCode = 0x1E020004;
|
errorCode = DJI_HMS_ERROR_CODE_VALUE4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -98,6 +98,10 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
|||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
*mutex = malloc(sizeof(pthread_mutex_t));
|
*mutex = malloc(sizeof(pthread_mutex_t));
|
||||||
if (*mutex == NULL) {
|
if (*mutex == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||||
@ -118,7 +122,11 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
int result;
|
int result = 0;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
result = pthread_mutex_destroy(mutex);
|
result = pthread_mutex_destroy(mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
@ -136,8 +144,13 @@ T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
int result = pthread_mutex_lock(mutex);
|
int result = 0;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = pthread_mutex_lock(mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -152,8 +165,13 @@ T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
int result = pthread_mutex_unlock(mutex);
|
int result = 0;
|
||||||
|
|
||||||
|
if (!mutex) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = pthread_mutex_unlock(mutex);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -308,6 +326,14 @@ T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum)
|
||||||
|
{
|
||||||
|
srand(time(NULL));
|
||||||
|
*randomNum = random() % 65535;
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void *Osal_Malloc(uint32_t size)
|
void *Osal_Malloc(uint32_t size)
|
||||||
{
|
{
|
||||||
return malloc(size);
|
return malloc(size);
|
||||||
|
@ -63,6 +63,7 @@ T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore);
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
||||||
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
||||||
|
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum);
|
||||||
|
|
||||||
void *Osal_Malloc(uint32_t size);
|
void *Osal_Malloc(uint32_t size);
|
||||||
void Osal_Free(void *ptr);
|
void Osal_Free(void *ptr);
|
||||||
|
@ -72,7 +72,8 @@ T_DjiReturnCode Osal_Socket(E_DjiSocketMode mode, T_DjiSocketHandle *socketHandl
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setsockopt(socketHandleStruct->socketFd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, optlen) < 0) {
|
if (setsockopt(socketHandleStruct->socketFd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, optlen) < 0)
|
||||||
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else if (mode == DJI_SOCKET_MODE_TCP) {
|
} else if (mode == DJI_SOCKET_MODE_TCP) {
|
||||||
|
@ -81,6 +81,7 @@ static pthread_t s_monitorThread = 0;
|
|||||||
|
|
||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
static T_DjiReturnCode DjiUser_PrepareSystemEnvironment(void);
|
static T_DjiReturnCode DjiUser_PrepareSystemEnvironment(void);
|
||||||
|
static T_DjiReturnCode DjiUser_CleanSystemEnvironment(void);
|
||||||
static T_DjiReturnCode DjiUser_FillInUserInfo(T_DjiUserInfo *userInfo);
|
static T_DjiReturnCode DjiUser_FillInUserInfo(T_DjiUserInfo *userInfo);
|
||||||
static T_DjiReturnCode DjiUser_PrintConsole(const uint8_t *data, uint16_t dataLen);
|
static T_DjiReturnCode DjiUser_PrintConsole(const uint8_t *data, uint16_t dataLen);
|
||||||
static T_DjiReturnCode DjiUser_LocalWrite(const uint8_t *data, uint16_t dataLen);
|
static T_DjiReturnCode DjiUser_LocalWrite(const uint8_t *data, uint16_t dataLen);
|
||||||
@ -180,7 +181,8 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_EXTENSION_PORT &&
|
if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_EXTENSION_PORT &&
|
||||||
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK) {
|
(aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK)) {
|
||||||
returnCode = DjiTest_WidgetInteractionStartService();
|
returnCode = DjiTest_WidgetInteractionStartService();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("widget interaction sample init error");
|
USER_LOG_ERROR("widget interaction sample init error");
|
||||||
@ -190,6 +192,13 @@ int main(int argc, char **argv)
|
|||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("widget speaker test init error");
|
USER_LOG_ERROR("widget speaker test init error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_MODULE_SAMPLE_MOP_CHANNEL_ON
|
||||||
|
returnCode = DjiTest_MopChannelStartService();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("mop channel sample init error");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_EMU_ON
|
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_EMU_ON
|
||||||
returnCode = DjiTest_CameraEmuBaseStartService();
|
returnCode = DjiTest_CameraEmuBaseStartService();
|
||||||
@ -339,6 +348,7 @@ static T_DjiReturnCode DjiUser_PrepareSystemEnvironment(void)
|
|||||||
.Free = Osal_Free,
|
.Free = Osal_Free,
|
||||||
.GetTimeMs = Osal_GetTimeMs,
|
.GetTimeMs = Osal_GetTimeMs,
|
||||||
.GetTimeUs = Osal_GetTimeUs,
|
.GetTimeUs = Osal_GetTimeUs,
|
||||||
|
.GetRandomNum = Osal_GetRandomNum,
|
||||||
};
|
};
|
||||||
|
|
||||||
T_DjiLoggerConsole printConsole = {
|
T_DjiLoggerConsole printConsole = {
|
||||||
@ -466,6 +476,39 @@ static T_DjiReturnCode DjiUser_PrepareSystemEnvironment(void)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static T_DjiReturnCode DjiUser_CleanSystemEnvironment(void)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||||
|
|
||||||
|
returnCode = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("get aircraft base info error");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_MODULE_SAMPLE_POWER_MANAGEMENT_ON
|
||||||
|
returnCode = DjiTest_PowerManagementStopService();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
perror("power management deinit error");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
|
||||||
|
returnCode = DjiTest_DataTransmissionStopService();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
perror("widget sample deinit error");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
returnCode = DjiCore_DeInit();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
perror("Core deinit failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode DjiUser_FillInUserInfo(T_DjiUserInfo *userInfo)
|
static T_DjiReturnCode DjiUser_FillInUserInfo(T_DjiUserInfo *userInfo)
|
||||||
{
|
{
|
||||||
if (userInfo == NULL) {
|
if (userInfo == NULL) {
|
||||||
@ -689,7 +732,15 @@ static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinSta
|
|||||||
|
|
||||||
static void DjiUser_NormalExitHandler(int signalNum)
|
static void DjiUser_NormalExitHandler(int signalNum)
|
||||||
{
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
|
||||||
USER_UTIL_UNUSED(signalNum);
|
USER_UTIL_UNUSED(signalNum);
|
||||||
|
|
||||||
|
returnCode = DjiUser_CleanSystemEnvironment();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
perror("Clean up system environment failed.");
|
||||||
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,17 +62,19 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
|||||||
#ifdef LIBUSB_INSTALLED
|
#ifdef LIBUSB_INSTALLED
|
||||||
ret = libusb_init(NULL);
|
ret = libusb_init(NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
USER_LOG_ERROR("init usb bulk failed, errno = %d", ret);
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
USER_LOG_ERROR("open usb device failed");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = libusb_claim_interface(handle, usbBulkInfo.channelInfo.interfaceNum);
|
ret = libusb_claim_interface(handle, usbBulkInfo.channelInfo.interfaceNum);
|
||||||
if (ret != LIBUSB_SUCCESS) {
|
if (ret != LIBUSB_SUCCESS) {
|
||||||
printf("libusb claim interface error");
|
USER_LOG_ERROR("libusb claim interface failed, errno = %d", ret);
|
||||||
libusb_close(handle);
|
libusb_close(handle);
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -114,6 +116,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
|||||||
T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
||||||
{
|
{
|
||||||
struct libusb_device_handle *handle = NULL;
|
struct libusb_device_handle *handle = NULL;
|
||||||
|
int32_t ret;
|
||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
|
||||||
if (usbBulkHandle == NULL) {
|
if (usbBulkHandle == NULL) {
|
||||||
@ -124,7 +127,11 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
|||||||
|
|
||||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||||
#ifdef LIBUSB_INSTALLED
|
#ifdef LIBUSB_INSTALLED
|
||||||
libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
ret = libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||||
|
if(ret != 0) {
|
||||||
|
USER_LOG_ERROR("release usb bulk interface failed, errno = %d", ret);
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
|
}
|
||||||
osalHandler->TaskSleepMs(100);
|
osalHandler->TaskSleepMs(100);
|
||||||
libusb_exit(NULL);
|
libusb_exit(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(dji_sdk_demo_on_jeston C)
|
project(dji_sdk_demo_on_jetson C)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
@ -337,6 +337,7 @@ static T_DjiReturnCode DjiUser_PrepareSystemEnvironment(void)
|
|||||||
.SemaphorePost = Osal_SemaphorePost,
|
.SemaphorePost = Osal_SemaphorePost,
|
||||||
.Malloc = Osal_Malloc,
|
.Malloc = Osal_Malloc,
|
||||||
.Free = Osal_Free,
|
.Free = Osal_Free,
|
||||||
|
.GetRandomNum = Osal_GetRandomNum,
|
||||||
.GetTimeMs = Osal_GetTimeMs,
|
.GetTimeMs = Osal_GetTimeMs,
|
||||||
.GetTimeUs = Osal_GetTimeUs,
|
.GetTimeUs = Osal_GetTimeUs,
|
||||||
};
|
};
|
@ -28,6 +28,7 @@
|
|||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
#define SEM_MUTEX_WAIT_FOREVER 0xFFFFFFFF
|
#define SEM_MUTEX_WAIT_FOREVER 0xFFFFFFFF
|
||||||
@ -64,6 +65,10 @@ T_DjiReturnCode Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), uin
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_TaskDestroy(T_DjiTaskHandle task)
|
T_DjiReturnCode Osal_TaskDestroy(T_DjiTaskHandle task)
|
||||||
{
|
{
|
||||||
|
if (task == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
vTaskDelete(task);
|
vTaskDelete(task);
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
@ -83,6 +88,10 @@ T_DjiReturnCode Osal_TaskSleepMs(uint32_t timeMs)
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
||||||
{
|
{
|
||||||
|
if (mutex == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
*mutex = xSemaphoreCreateMutex();
|
*mutex = xSemaphoreCreateMutex();
|
||||||
if (*mutex == NULL) {
|
if (*mutex == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
@ -93,6 +102,10 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
|
if (mutex == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
vQueueDelete((SemaphoreHandle_t) mutex);
|
vQueueDelete((SemaphoreHandle_t) mutex);
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
@ -117,6 +130,10 @@ T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
||||||
{
|
{
|
||||||
|
if (mutex == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
if (xSemaphoreGive(mutex) != pdTRUE) {
|
if (xSemaphoreGive(mutex) != pdTRUE) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -128,6 +145,10 @@ T_DjiReturnCode Osal_SemaphoreCreate(uint32_t initValue, T_DjiSemaHandle *semaph
|
|||||||
{
|
{
|
||||||
uint32_t maxCount = UINT_MAX;
|
uint32_t maxCount = UINT_MAX;
|
||||||
|
|
||||||
|
if (semaphore == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
*semaphore = xSemaphoreCreateCounting(maxCount, initValue);
|
*semaphore = xSemaphoreCreateCounting(maxCount, initValue);
|
||||||
|
|
||||||
if (*semaphore == NULL) {
|
if (*semaphore == NULL) {
|
||||||
@ -139,6 +160,10 @@ T_DjiReturnCode Osal_SemaphoreCreate(uint32_t initValue, T_DjiSemaHandle *semaph
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphoreDestroy(T_DjiSemaHandle semaphore)
|
T_DjiReturnCode Osal_SemaphoreDestroy(T_DjiSemaHandle semaphore)
|
||||||
{
|
{
|
||||||
|
if (semaphore == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
vSemaphoreDelete(semaphore);
|
vSemaphoreDelete(semaphore);
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
@ -177,6 +202,10 @@ T_DjiReturnCode Osal_SemaphoreWait(T_DjiSemaHandle semaphore)
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore)
|
T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore)
|
||||||
{
|
{
|
||||||
|
if (semaphore == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
if (xSemaphoreGive(semaphore) != pdTRUE) {
|
if (xSemaphoreGive(semaphore) != pdTRUE) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -186,6 +215,10 @@ T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore)
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms)
|
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms)
|
||||||
{
|
{
|
||||||
|
if (ms == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
*ms = xTaskGetTickCount();
|
*ms = xTaskGetTickCount();
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
@ -193,11 +226,22 @@ T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms)
|
|||||||
|
|
||||||
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
||||||
{
|
{
|
||||||
|
if (us == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
*us = xTaskGetTickCount() * 1000;
|
*us = xTaskGetTickCount() * 1000;
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum)
|
||||||
|
{
|
||||||
|
*randomNum = rand() % 65535;
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void *Osal_Malloc(uint32_t size)
|
void *Osal_Malloc(uint32_t size)
|
||||||
{
|
{
|
||||||
return pvPortMalloc(size);
|
return pvPortMalloc(size);
|
||||||
|
@ -43,35 +43,21 @@ extern "C" {
|
|||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
T_DjiReturnCode Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), uint32_t stackSize,
|
T_DjiReturnCode Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), uint32_t stackSize,
|
||||||
void *arg, T_DjiTaskHandle *task);
|
void *arg, T_DjiTaskHandle *task);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_TaskDestroy(T_DjiTaskHandle task);
|
T_DjiReturnCode Osal_TaskDestroy(T_DjiTaskHandle task);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_TaskSleepMs(uint32_t timeMs);
|
T_DjiReturnCode Osal_TaskSleepMs(uint32_t timeMs);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex);
|
T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex);
|
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex);
|
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex);
|
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphoreCreate(uint32_t initValue, T_DjiSemaHandle *semaphore);
|
T_DjiReturnCode Osal_SemaphoreCreate(uint32_t initValue, T_DjiSemaHandle *semaphore);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphoreDestroy(T_DjiSemaHandle semaphore);
|
T_DjiReturnCode Osal_SemaphoreDestroy(T_DjiSemaHandle semaphore);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphoreTimedWait(T_DjiSemaHandle semaphore, uint32_t waitTimeMs);
|
T_DjiReturnCode Osal_SemaphoreTimedWait(T_DjiSemaHandle semaphore, uint32_t waitTimeMs);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphoreWait(T_DjiSemaHandle semaphore);
|
T_DjiReturnCode Osal_SemaphoreWait(T_DjiSemaHandle semaphore);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore);
|
T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
||||||
|
|
||||||
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
||||||
|
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum);
|
||||||
void *Osal_Malloc(uint32_t size);
|
void *Osal_Malloc(uint32_t size);
|
||||||
|
|
||||||
void Osal_Free(void *ptr);
|
void Osal_Free(void *ptr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -97,6 +97,7 @@ void DjiUser_StartTask(void const *argument)
|
|||||||
.Free = Osal_Free,
|
.Free = Osal_Free,
|
||||||
.GetTimeMs = Osal_GetTimeMs,
|
.GetTimeMs = Osal_GetTimeMs,
|
||||||
.GetTimeUs = Osal_GetTimeUs,
|
.GetTimeUs = Osal_GetTimeUs,
|
||||||
|
.GetRandomNum = Osal_GetRandomNum,
|
||||||
};
|
};
|
||||||
T_DjiLoggerConsole printConsole = {
|
T_DjiLoggerConsole printConsole = {
|
||||||
.func = DjiUser_PrintConsole,
|
.func = DjiUser_PrintConsole,
|
||||||
@ -247,7 +248,8 @@ void DjiUser_StartTask(void const *argument)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
|
#ifdef CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK
|
if ((aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK)
|
||||||
&& aircraftInfoBaseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_NONE) {
|
&& aircraftInfoBaseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_NONE) {
|
||||||
USER_LOG_WARN("Not support gimbal emu sample.");
|
USER_LOG_WARN("Not support gimbal emu sample.");
|
||||||
} else {
|
} else {
|
||||||
@ -294,7 +296,8 @@ void DjiUser_StartTask(void const *argument)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_POSITIONING_ON
|
#ifdef CONFIG_MODULE_SAMPLE_POSITIONING_ON
|
||||||
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK
|
if ((aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M300_RTK ||
|
||||||
|
aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M350_RTK)
|
||||||
&& aircraftInfoBaseInfo.mountPosition != DJI_MOUNT_POSITION_TYPE_EXTENSION_PORT) {
|
&& aircraftInfoBaseInfo.mountPosition != DJI_MOUNT_POSITION_TYPE_EXTENSION_PORT) {
|
||||||
if (DjiTest_PositioningStartService() != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (DjiTest_PositioningStartService() != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("psdk positioning init error");
|
USER_LOG_ERROR("psdk positioning init error");
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#define UART1_WRITE_BUF_SIZE 64
|
#define UART1_WRITE_BUF_SIZE 64
|
||||||
#define UART2_READ_BUF_SIZE 64
|
#define UART2_READ_BUF_SIZE 64
|
||||||
#define UART2_WRITE_BUF_SIZE 2048
|
#define UART2_WRITE_BUF_SIZE 2048
|
||||||
#define UART3_READ_BUF_SIZE 4096
|
#define UART3_READ_BUF_SIZE 8192
|
||||||
#define UART3_WRITE_BUF_SIZE 2048
|
#define UART3_WRITE_BUF_SIZE 2048
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
@ -81,11 +81,15 @@ T_DjiReturnCode DjiUpgradePlatformStm32_WriteUpgradeProgramFile(uint32_t offset,
|
|||||||
{
|
{
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
|
|
||||||
|
__disable_irq();
|
||||||
|
|
||||||
result = FLASH_If_Write(APPLICATION_STORE_ADDRESS + offset, (uint8_t *) data, dataLen);
|
result = FLASH_If_Write(APPLICATION_STORE_ADDRESS + offset, (uint8_t *) data, dataLen);
|
||||||
if (result != FLASHIF_OK) {
|
if (result != FLASHIF_OK) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__enable_irq();
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user