NEW: release DJI Payload-SDK version 3.12.0
This commit is contained in:
@ -99,6 +99,7 @@ static void DjiTest_FlightControlVelocityControlSample(void);
|
||||
static void DjiTest_FlightControlArrestFlyingSample(void);
|
||||
static void DjiTest_FlightControlSetGetParamSample(void);
|
||||
static void DjiTest_FlightControlPassiveTriggerFtsSample(void);
|
||||
static void DjiTest_FlightControlSlowRotateMotorSample(void);
|
||||
static T_DjiReturnCode DjiTest_TriggerFtsEventCallback(void);
|
||||
static void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect);
|
||||
|
||||
@ -922,6 +923,63 @@ void DjiTest_FlightControlPassiveTriggerFtsSample(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void DjiTest_FlightControlSlowRotateMotorSample(void)
|
||||
{
|
||||
E_DjiFlightControllerElectronicSpeedControllerStatus escStatus;
|
||||
|
||||
T_DjiReturnCode returnCode = 0;
|
||||
|
||||
USER_LOG_INFO("Start rotating.");
|
||||
returnCode = DjiFlightController_StartSlowRotateMotor();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Start slow rotate blade failed, error code is 0x%08X", returnCode);
|
||||
return ;
|
||||
}
|
||||
|
||||
returnCode = DjiFlightController_GetElectronicSpeedControllerStatus(&escStatus);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Fail to get ESC status, error code is 0x%08X", returnCode);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The ESC status is: %s motor(s) in rotate mode",
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_NO_MOTOR_IN_SLOW_ROTATE_MODE ? "no" :
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_SOME_MOTOR_IN_SLOW_ROTATE_MODE ? "some" :
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_ALL_MOTOR_IN_SLOW_ROTATE_MODE ? "all" : "(error)");
|
||||
|
||||
for (int32_t i = 0; i < 8; i++) {
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
|
||||
returnCode = DjiFlightController_GetElectronicSpeedControllerStatus(&escStatus);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Fail to get ESC status, error code is 0x%08X", returnCode);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The ESC status is: %s motor(s) in rotate mode",
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_NO_MOTOR_IN_SLOW_ROTATE_MODE ? "no" :
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_SOME_MOTOR_IN_SLOW_ROTATE_MODE ? "some" :
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_ALL_MOTOR_IN_SLOW_ROTATE_MODE ? "all" : "(error)");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Stop rotating.");
|
||||
returnCode = DjiFlightController_StopSlowRotateMotor();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Stop slow rotate blade failed, error code is 0x%08X", returnCode);
|
||||
return ;
|
||||
}
|
||||
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
|
||||
returnCode = DjiFlightController_GetElectronicSpeedControllerStatus(&escStatus);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Fail to get ESC status, error code is 0x%08X", returnCode);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The ESC status is: %s motor(s) in rotate mode",
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_NO_MOTOR_IN_SLOW_ROTATE_MODE ? "no" :
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_SOME_MOTOR_IN_SLOW_ROTATE_MODE ? "some" :
|
||||
escStatus == DJI_FLIGHT_CONTROLLER_ALL_MOTOR_IN_SLOW_ROTATE_MODE ? "all" : "(error)");
|
||||
}
|
||||
|
||||
void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect)
|
||||
{
|
||||
switch (flightCtrlSampleSelect) {
|
||||
@ -953,6 +1011,10 @@ void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampl
|
||||
DjiTest_FlightControlPassiveTriggerFtsSample();
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SLOW_ROTATE_BLADE: {
|
||||
DjiTest_FlightControlSlowRotateMotorSample();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1305,6 +1367,8 @@ bool DjiTest_FlightControlGoHomeAndConfirmLanding(void)
|
||||
if (DJI_AIRCRAFT_TYPE_M3E == aircraftInfoBaseInfo.aircraftType || DJI_AIRCRAFT_TYPE_M3T == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M3D == aircraftInfoBaseInfo.aircraftType || DJI_AIRCRAFT_TYPE_M3TD == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M4T == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M4TD == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M4D == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M4E == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M4TD == aircraftInfoBaseInfo.aircraftType
|
||||
|| DJI_AIRCRAFT_TYPE_M4D == aircraftInfoBaseInfo.aircraftType
|
||||
@ -1608,4 +1672,62 @@ DjiTest_FlightControlJoystickCtrlAuthSwitchEventCallback(T_DjiFlightControllerJo
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_FlightControlSetFtsTrigger(E_DjiMountPosition position, char* desc)
|
||||
{
|
||||
T_DjiReturnCode djiStat;
|
||||
T_DjiFtsPwmEscTriggerStatus esc_status;
|
||||
|
||||
djiStat = DjiFlightController_SelectFtsPwmTrigger(position);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("select fts pwm trigger E-PORT error, error code: 0x%08X", djiStat);
|
||||
return djiStat;
|
||||
}
|
||||
|
||||
djiStat = DjiFlightController_GetFtsPwmTriggerStatus(&esc_status);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get pwm trigger status error, error code: 0x%08X", djiStat);
|
||||
return djiStat;
|
||||
}
|
||||
|
||||
if (esc_status.ESC[0].fts_select != position || esc_status.ESC[1].fts_select != position)
|
||||
{
|
||||
USER_LOG_ERROR("pwm trigger status incorrect");
|
||||
return djiStat;
|
||||
}
|
||||
|
||||
if (esc_status.ESC[0].fts_status == DJI_FLIGHT_CONTROLLER_FTS_NOT_TRIGGERD && esc_status.ESC[1].fts_status == DJI_FLIGHT_CONTROLLER_FTS_NOT_TRIGGERD)
|
||||
|
||||
USER_LOG_INFO("Set fts trigger position %s success", desc);
|
||||
|
||||
return djiStat;
|
||||
}
|
||||
|
||||
T_DjiReturnCode DjiTest_FlightControlFtsPwmTriggerSample(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
|
||||
returnCode = DjiTest_FlightControlInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init flight Control sample failed,error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
returnCode = DjiTest_FlightControlSetFtsTrigger(DJI_MOUNT_POSITION_EXTENSION_PORT, "DJI_MOUNT_POSITION_EXTENSION_PORT");
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Test select DJI_MOUNT_POSITION_EXTENSION_PORT fts pwm trigger failed");
|
||||
return returnCode;
|
||||
}
|
||||
returnCode = DjiTest_FlightControlSetFtsTrigger(DJI_MOUNT_POSITION_EXTENSION_LITE_PORT, "DJI_MOUNT_POSITION_EXTENSION_LITE_PORT");
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Test select DJI_MOUNT_POSITION_EXTENSION_LITE_PORT fts pwm trigger failed");
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
returnCode = DjiTest_FlightControlDeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Deinit Flight Control sample failed,error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
|
||||
@ -43,6 +43,7 @@ typedef enum {
|
||||
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_ARREST_FLYING,
|
||||
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM,
|
||||
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_FTS_TRIGGER,
|
||||
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SLOW_ROTATE_BLADE,
|
||||
} E_DjiTestFlightCtrlSampleSelect;
|
||||
|
||||
#pragma pack(1)
|
||||
@ -59,6 +60,7 @@ typedef struct {
|
||||
T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect);
|
||||
void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
||||
uint32_t timeMs);
|
||||
T_DjiReturnCode DjiTest_FlightControlFtsPwmTriggerSample(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user