相机控制
This commit is contained in:
@ -75,12 +75,12 @@ typedef struct {
|
|||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
static bool s_isCamInited = false;
|
static bool s_isCamInited = false;
|
||||||
|
|
||||||
static T_DjiCameraCommonHandler s_commonHandler;
|
static T_DjiCameraCommonHandler s_commonHandler;//注册相机类基础功能
|
||||||
static T_DjiCameraExposureMeteringHandler s_exposureMeteringHandler;
|
static T_DjiCameraExposureMeteringHandler s_exposureMeteringHandler;//用于测光
|
||||||
static T_DjiCameraFocusHandler s_focusHandler;
|
static T_DjiCameraFocusHandler s_focusHandler;//设置对焦
|
||||||
static T_DjiCameraDigitalZoomHandler s_digitalZoomHandler;
|
static T_DjiCameraDigitalZoomHandler s_digitalZoomHandler;//数字变焦
|
||||||
static T_DjiCameraOpticalZoomHandler s_opticalZoomHandler;
|
static T_DjiCameraOpticalZoomHandler s_opticalZoomHandler;//光学变焦
|
||||||
static T_DjiCameraTapZoomHandler s_tapZoomHandler;
|
static T_DjiCameraTapZoomHandler s_tapZoomHandler;//指点变焦功能
|
||||||
|
|
||||||
static T_DjiTaskHandle s_userCameraThread;
|
static T_DjiTaskHandle s_userCameraThread;
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ static E_DjiCameraMeteringMode s_cameraMeteringMode = DJI_CAMERA_METERING_MODE_C
|
|||||||
static T_DjiCameraSpotMeteringTarget s_cameraSpotMeteringTarget = {0};
|
static T_DjiCameraSpotMeteringTarget s_cameraSpotMeteringTarget = {0};
|
||||||
|
|
||||||
static E_DjiCameraFocusMode s_cameraFocusMode = DJI_CAMERA_FOCUS_MODE_AUTO;
|
static E_DjiCameraFocusMode s_cameraFocusMode = DJI_CAMERA_FOCUS_MODE_AUTO;
|
||||||
static T_DjiCameraPointInScreen s_cameraFocusTarget = {0};
|
static T_DjiCameraPointInScreen s_cameraFocusTarget = {0};//对焦点
|
||||||
static uint32_t s_cameraFocusRingValue = FOCUS_MID_RINGVALUE;
|
static uint32_t s_cameraFocusRingValue = FOCUS_MID_RINGVALUE;//对焦环
|
||||||
static T_DjiCameraFocusAssistantSettings s_cameraFocusAssistantSettings = {0};
|
static T_DjiCameraFocusAssistantSettings s_cameraFocusAssistantSettings = {0};
|
||||||
|
|
||||||
static E_DjiCameraZoomDirection s_cameraZoomDirection = DJI_CAMERA_ZOOM_DIRECTION_OUT;
|
static E_DjiCameraZoomDirection s_cameraZoomDirection = DJI_CAMERA_ZOOM_DIRECTION_OUT;
|
||||||
@ -120,6 +120,7 @@ static T_DjiMutexHandle s_tapZoomMutex = NULL;
|
|||||||
static E_DjiCameraVideoStreamType s_cameraVideoStreamType;
|
static E_DjiCameraVideoStreamType s_cameraVideoStreamType;
|
||||||
|
|
||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
|
//用于s_commonHandler中的回调函数:相机类基础功能
|
||||||
static T_DjiReturnCode GetSystemState(T_DjiCameraSystemState *systemState);
|
static T_DjiReturnCode GetSystemState(T_DjiCameraSystemState *systemState);
|
||||||
static T_DjiReturnCode SetMode(E_DjiCameraMode mode);
|
static T_DjiReturnCode SetMode(E_DjiCameraMode mode);
|
||||||
static T_DjiReturnCode StartRecordVideo(void);
|
static T_DjiReturnCode StartRecordVideo(void);
|
||||||
@ -135,11 +136,13 @@ static T_DjiReturnCode GetPhotoTimeIntervalSettings(T_DjiCameraPhotoTimeInterval
|
|||||||
static T_DjiReturnCode GetSDCardState(T_DjiCameraSDCardState *sdCardState);
|
static T_DjiReturnCode GetSDCardState(T_DjiCameraSDCardState *sdCardState);
|
||||||
static T_DjiReturnCode FormatSDCard(void);
|
static T_DjiReturnCode FormatSDCard(void);
|
||||||
|
|
||||||
|
//用于s_exposureMeteringHandler中的回调函数:测光
|
||||||
static T_DjiReturnCode SetMeteringMode(E_DjiCameraMeteringMode mode);
|
static T_DjiReturnCode SetMeteringMode(E_DjiCameraMeteringMode mode);
|
||||||
static T_DjiReturnCode GetMeteringMode(E_DjiCameraMeteringMode *mode);
|
static T_DjiReturnCode GetMeteringMode(E_DjiCameraMeteringMode *mode);
|
||||||
static T_DjiReturnCode SetSpotMeteringTarget(T_DjiCameraSpotMeteringTarget target);
|
static T_DjiReturnCode SetSpotMeteringTarget(T_DjiCameraSpotMeteringTarget target);
|
||||||
static T_DjiReturnCode GetSpotMeteringTarget(T_DjiCameraSpotMeteringTarget *target);
|
static T_DjiReturnCode GetSpotMeteringTarget(T_DjiCameraSpotMeteringTarget *target);
|
||||||
|
|
||||||
|
//用于s_focusHandler中的回调函数:设置对焦功能
|
||||||
static T_DjiReturnCode SetFocusMode(E_DjiCameraFocusMode mode);
|
static T_DjiReturnCode SetFocusMode(E_DjiCameraFocusMode mode);
|
||||||
static T_DjiReturnCode GetFocusMode(E_DjiCameraFocusMode *mode);
|
static T_DjiReturnCode GetFocusMode(E_DjiCameraFocusMode *mode);
|
||||||
static T_DjiReturnCode SetFocusTarget(T_DjiCameraPointInScreen target);
|
static T_DjiReturnCode SetFocusTarget(T_DjiCameraPointInScreen target);
|
||||||
@ -150,18 +153,25 @@ static T_DjiReturnCode SetFocusRingValue(uint32_t value);
|
|||||||
static T_DjiReturnCode GetFocusRingValue(uint32_t *value);
|
static T_DjiReturnCode GetFocusRingValue(uint32_t *value);
|
||||||
static T_DjiReturnCode GetFocusRingValueUpperBound(uint32_t *value);
|
static T_DjiReturnCode GetFocusRingValueUpperBound(uint32_t *value);
|
||||||
|
|
||||||
|
//用于s_digitalZoomHandler的回调函数中:数字变焦功能
|
||||||
static T_DjiReturnCode SetDigitalZoomFactor(dji_f32_t factor);
|
static T_DjiReturnCode SetDigitalZoomFactor(dji_f32_t factor);
|
||||||
|
|
||||||
|
//用于s_opticalZoomHandler的回调函数中:光学变焦功能
|
||||||
static T_DjiReturnCode SetOpticalZoomFocalLength(uint32_t focalLength);
|
static T_DjiReturnCode SetOpticalZoomFocalLength(uint32_t focalLength);
|
||||||
static T_DjiReturnCode GetOpticalZoomFocalLength(uint32_t *focalLength);
|
static T_DjiReturnCode GetOpticalZoomFocalLength(uint32_t *focalLength);
|
||||||
static T_DjiReturnCode GetOpticalZoomSpec(T_DjiCameraOpticalZoomSpec *spec);
|
static T_DjiReturnCode GetOpticalZoomSpec(T_DjiCameraOpticalZoomSpec *spec);
|
||||||
static T_DjiReturnCode StartContinuousOpticalZoom(E_DjiCameraZoomDirection direction, E_DjiCameraZoomSpeed speed);
|
static T_DjiReturnCode StartContinuousOpticalZoom(E_DjiCameraZoomDirection direction, E_DjiCameraZoomSpeed speed);
|
||||||
static T_DjiReturnCode StopContinuousOpticalZoom(void);
|
static T_DjiReturnCode StopContinuousOpticalZoom(void);
|
||||||
|
|
||||||
|
//用于s_tapZoomHandler中的回调函数:指点变焦功能
|
||||||
static T_DjiReturnCode GetTapZoomState(T_DjiCameraTapZoomState *state);
|
static T_DjiReturnCode GetTapZoomState(T_DjiCameraTapZoomState *state);
|
||||||
static T_DjiReturnCode SetTapZoomEnabled(bool enabledFlag);
|
static T_DjiReturnCode SetTapZoomEnabled(bool enabledFlag);
|
||||||
static T_DjiReturnCode GetTapZoomEnabled(bool *enabledFlag);
|
static T_DjiReturnCode GetTapZoomEnabled(bool *enabledFlag);
|
||||||
static T_DjiReturnCode SetTapZoomMultiplier(uint8_t multiplier);
|
static T_DjiReturnCode SetTapZoomMultiplier(uint8_t multiplier);
|
||||||
static T_DjiReturnCode GetTapZoomMultiplier(uint8_t *multiplier);
|
static T_DjiReturnCode GetTapZoomMultiplier(uint8_t *multiplier);
|
||||||
static T_DjiReturnCode TapZoomAtTarget(T_DjiCameraPointInScreen target);
|
static T_DjiReturnCode TapZoomAtTarget(T_DjiCameraPointInScreen target);
|
||||||
|
|
||||||
|
//
|
||||||
static T_DjiReturnCode DjiTest_CameraHybridZoom(uint32_t focalLength);
|
static T_DjiReturnCode DjiTest_CameraHybridZoom(uint32_t focalLength);
|
||||||
static T_DjiReturnCode DjiTest_CameraRotationGimbal(T_TestCameraGimbalRotationArgument gimbalRotationArgument);
|
static T_DjiReturnCode DjiTest_CameraRotationGimbal(T_TestCameraGimbalRotationArgument gimbalRotationArgument);
|
||||||
|
|
||||||
@ -826,6 +836,7 @@ static T_DjiReturnCode TapZoomAtTarget(T_DjiCameraPointInScreen target)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT_IN_CURRENT_STATE;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT_IN_CURRENT_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置云台相机指点变焦的模式
|
||||||
rotationMode = DJI_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE;
|
rotationMode = DJI_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE;
|
||||||
rotationProperty.relativeAngleRotation.actionTime = TAP_ZOOM_DURATION / 10;
|
rotationProperty.relativeAngleRotation.actionTime = TAP_ZOOM_DURATION / 10;
|
||||||
|
|
||||||
@ -938,8 +949,8 @@ static T_DjiReturnCode DjiTest_CameraRotationGimbal(T_TestCameraGimbalRotationAr
|
|||||||
|
|
||||||
static void *UserCamera_Task(void *arg)
|
static void *UserCamera_Task(void *arg)
|
||||||
{
|
{
|
||||||
static uint32_t photoCnt = 0;
|
static uint32_t photoCnt = 0;//????????
|
||||||
static uint32_t step = 0;
|
static uint32_t step = 0;//控制任务的执行时间间隔
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
int32_t tempFocalLength = 0;
|
int32_t tempFocalLength = 0;
|
||||||
dji_f32_t tempDigitalFactor = 0.0f;
|
dji_f32_t tempDigitalFactor = 0.0f;
|
||||||
@ -950,7 +961,7 @@ static void *UserCamera_Task(void *arg)
|
|||||||
USER_UTIL_UNUSED(arg);
|
USER_UTIL_UNUSED(arg);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
osalHandler->TaskSleepMs(1000 / PAYLOAD_CAMERA_EMU_TASK_FREQ);
|
osalHandler->TaskSleepMs(1000 / PAYLOAD_CAMERA_EMU_TASK_FREQ);//睡眠10ms
|
||||||
step++;
|
step++;
|
||||||
|
|
||||||
returnCode = osalHandler->MutexLock(s_commonMutex);
|
returnCode = osalHandler->MutexLock(s_commonMutex);
|
||||||
@ -964,11 +975,13 @@ static void *UserCamera_Task(void *arg)
|
|||||||
s_cameraSDCardState.availableCaptureCount = s_cameraSDCardState.remainSpaceInMB / SDCARD_PER_PHOTO_SPACE_IN_MB;
|
s_cameraSDCardState.availableCaptureCount = s_cameraSDCardState.remainSpaceInMB / SDCARD_PER_PHOTO_SPACE_IN_MB;
|
||||||
|
|
||||||
//realize your photo shoot and storage logic here
|
//realize your photo shoot and storage logic here
|
||||||
|
//1. 确认拍照状态:使用PSDK 开发的相机类负载设备在执行完拍照动作后,需要获取负载设备的拍照状态。
|
||||||
if (s_cameraState.shootingState != DJI_CAMERA_SHOOTING_PHOTO_IDLE &&
|
if (s_cameraState.shootingState != DJI_CAMERA_SHOOTING_PHOTO_IDLE &&
|
||||||
photoCnt++ > TAKING_PHOTO_SPENT_TIME_MS_EMU / (1000 / PAYLOAD_CAMERA_EMU_TASK_FREQ)) {
|
photoCnt++ > TAKING_PHOTO_SPENT_TIME_MS_EMU / (1000 / PAYLOAD_CAMERA_EMU_TASK_FREQ)) {
|
||||||
photoCnt = 0;
|
photoCnt = 0;
|
||||||
|
|
||||||
//store the photo after shooting finished
|
//store the photo after shooting finished
|
||||||
|
//2. 存储照片:相机类负载设备在执行完拍照后,使用PSDK 开发的相机类负载设备将相机拍摄的照片存储在相机类负载设备上的内存卡中。
|
||||||
if (s_cameraShootPhotoMode == DJI_CAMERA_SHOOT_PHOTO_MODE_SINGLE) {
|
if (s_cameraShootPhotoMode == DJI_CAMERA_SHOOT_PHOTO_MODE_SINGLE) {
|
||||||
s_cameraSDCardState.remainSpaceInMB =
|
s_cameraSDCardState.remainSpaceInMB =
|
||||||
s_cameraSDCardState.remainSpaceInMB - SDCARD_PER_PHOTO_SPACE_IN_MB;
|
s_cameraSDCardState.remainSpaceInMB - SDCARD_PER_PHOTO_SPACE_IN_MB;
|
||||||
@ -989,6 +1002,7 @@ static void *UserCamera_Task(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check the remain space of sdcard
|
//check the remain space of sdcard
|
||||||
|
//3. 检查存储空间:
|
||||||
if (s_cameraSDCardState.remainSpaceInMB > SDCARD_TOTAL_SPACE_IN_MB) {
|
if (s_cameraSDCardState.remainSpaceInMB > SDCARD_TOTAL_SPACE_IN_MB) {
|
||||||
s_cameraSDCardState.remainSpaceInMB = 0;
|
s_cameraSDCardState.remainSpaceInMB = 0;
|
||||||
s_cameraSDCardState.isFull = true;
|
s_cameraSDCardState.isFull = true;
|
||||||
@ -1025,6 +1039,8 @@ static void *UserCamera_Task(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 10Hz
|
// 10Hz
|
||||||
|
// ! step%10:相当于10毫秒执行一次,tc → Add logic here for zoom camera
|
||||||
|
//没看关于这个if
|
||||||
if (USER_UTIL_IS_WORK_TURN(step, 10, PAYLOAD_CAMERA_EMU_TASK_FREQ)) {
|
if (USER_UTIL_IS_WORK_TURN(step, 10, PAYLOAD_CAMERA_EMU_TASK_FREQ)) {
|
||||||
returnCode = osalHandler->MutexLock(s_zoomMutex);
|
returnCode = osalHandler->MutexLock(s_zoomMutex);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -1146,6 +1162,7 @@ out:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 预估可拍照张数和可录像时长的功能。
|
||||||
if (s_cameraState.isRecording) {
|
if (s_cameraState.isRecording) {
|
||||||
s_cameraState.currentVideoRecordingTimeInSeconds++;
|
s_cameraState.currentVideoRecordingTimeInSeconds++;
|
||||||
s_cameraSDCardState.remainSpaceInMB =
|
s_cameraSDCardState.remainSpaceInMB =
|
||||||
@ -1250,27 +1267,29 @@ T_DjiReturnCode DjiTest_CameraEmuBaseStartService(void)
|
|||||||
SDCARD_TOTAL_SPACE_IN_MB / SDCARD_PER_SECONDS_RECORD_SPACE_IN_MB;
|
SDCARD_TOTAL_SPACE_IN_MB / SDCARD_PER_SECONDS_RECORD_SPACE_IN_MB;
|
||||||
|
|
||||||
/* Register the camera common handler */
|
/* Register the camera common handler */
|
||||||
|
//注册相机类基础功能,(1)SetMode:设置相机工作模式(照片/视频/回放);(2)如果是photo模式,使用SetShootPhotoMode设置照片拍照模式;(3)StartShootPhoto开始拍摄照片
|
||||||
s_commonHandler.GetSystemState = GetSystemState;
|
s_commonHandler.GetSystemState = GetSystemState;
|
||||||
s_commonHandler.SetMode = SetMode;
|
s_commonHandler.SetMode = SetMode;//设置相机模式:照片/视频/回放
|
||||||
s_commonHandler.GetMode = DjiTest_CameraGetMode;
|
s_commonHandler.GetMode = DjiTest_CameraGetMode;
|
||||||
s_commonHandler.StartRecordVideo = StartRecordVideo;
|
s_commonHandler.StartRecordVideo = StartRecordVideo;//控制相机录像:s_cameraState.isRecording = true;
|
||||||
s_commonHandler.StopRecordVideo = StopRecordVideo;
|
s_commonHandler.StopRecordVideo = StopRecordVideo;
|
||||||
s_commonHandler.StartShootPhoto = StartShootPhoto;
|
s_commonHandler.StartShootPhoto = StartShootPhoto;//控制相机拍摄照片:单拍/连拍/等时间间隔;只是改变了s_cameraState的状态
|
||||||
s_commonHandler.StopShootPhoto = StopShootPhoto;
|
s_commonHandler.StopShootPhoto = StopShootPhoto;
|
||||||
s_commonHandler.SetShootPhotoMode = SetShootPhotoMode;
|
s_commonHandler.SetShootPhotoMode = SetShootPhotoMode;//写入变量s_cameraShootPhotoMode,设置相机类负载的拍照模式:单拍/连拍/等时间间隔
|
||||||
s_commonHandler.GetShootPhotoMode = GetShootPhotoMode;
|
s_commonHandler.GetShootPhotoMode = GetShootPhotoMode;//读取变量s_cameraShootPhotoMode
|
||||||
s_commonHandler.SetPhotoBurstCount = SetPhotoBurstCount;
|
s_commonHandler.SetPhotoBurstCount = SetPhotoBurstCount;//控制相机连拍,写入变量s_cameraBurstCount
|
||||||
s_commonHandler.GetPhotoBurstCount = GetPhotoBurstCount;
|
s_commonHandler.GetPhotoBurstCount = GetPhotoBurstCount;// 读取变量s_cameraBurstCount
|
||||||
s_commonHandler.SetPhotoTimeIntervalSettings = SetPhotoTimeIntervalSettings;
|
s_commonHandler.SetPhotoTimeIntervalSettings = SetPhotoTimeIntervalSettings;//控制相机定时拍照,变量s_cameraPhotoTimeIntervalSettings有啥用,
|
||||||
s_commonHandler.GetPhotoTimeIntervalSettings = GetPhotoTimeIntervalSettings;
|
s_commonHandler.GetPhotoTimeIntervalSettings = GetPhotoTimeIntervalSettings;// 读取变量s_cameraPhotoTimeIntervalSettings
|
||||||
s_commonHandler.GetSDCardState = GetSDCardState;
|
s_commonHandler.GetSDCardState = GetSDCardState;//获取SD 卡的当前状态
|
||||||
s_commonHandler.FormatSDCard = FormatSDCard;
|
s_commonHandler.FormatSDCard = FormatSDCard;//SD卡格式化
|
||||||
|
|
||||||
returnCode = DjiPayloadCamera_RegCommonHandler(&s_commonHandler);
|
returnCode = DjiPayloadCamera_RegCommonHandler(&s_commonHandler);//注册相机类基础功能
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("camera register common handler error:0x%08llX", returnCode);
|
USER_LOG_ERROR("camera register common handler error:0x%08llX", returnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//注册相机测光功能
|
||||||
/* Register the camera metering handler */
|
/* Register the camera metering handler */
|
||||||
#if USER_CAMERA_EMU_METERING_ON
|
#if USER_CAMERA_EMU_METERING_ON
|
||||||
s_exposureMeteringHandler.SetMeteringMode = SetMeteringMode;
|
s_exposureMeteringHandler.SetMeteringMode = SetMeteringMode;
|
||||||
@ -1285,15 +1304,16 @@ T_DjiReturnCode DjiTest_CameraEmuBaseStartService(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//注册相机设置对焦功能
|
||||||
/* Register the camera focus handler */
|
/* Register the camera focus handler */
|
||||||
#if USER_CAMERA_EMU_FOCUS_ON
|
#if USER_CAMERA_EMU_FOCUS_ON
|
||||||
s_focusHandler.SetFocusMode = SetFocusMode;
|
s_focusHandler.SetFocusMode = SetFocusMode;
|
||||||
s_focusHandler.GetFocusMode = GetFocusMode;
|
s_focusHandler.GetFocusMode = GetFocusMode;
|
||||||
s_focusHandler.SetFocusTarget = SetFocusTarget;
|
s_focusHandler.SetFocusTarget = SetFocusTarget;//设置对焦点
|
||||||
s_focusHandler.GetFocusTarget = GetFocusTarget;
|
s_focusHandler.GetFocusTarget = GetFocusTarget;
|
||||||
s_focusHandler.SetFocusAssistantSettings = SetFocusAssistantSettings;
|
s_focusHandler.SetFocusAssistantSettings = SetFocusAssistantSettings;
|
||||||
s_focusHandler.GetFocusAssistantSettings = GetFocusAssistantSettings;
|
s_focusHandler.GetFocusAssistantSettings = GetFocusAssistantSettings;
|
||||||
s_focusHandler.SetFocusRingValue = SetFocusRingValue;
|
s_focusHandler.SetFocusRingValue = SetFocusRingValue;//设置对焦环
|
||||||
s_focusHandler.GetFocusRingValue = GetFocusRingValue;
|
s_focusHandler.GetFocusRingValue = GetFocusRingValue;
|
||||||
s_focusHandler.GetFocusRingValueUpperBound = GetFocusRingValueUpperBound;
|
s_focusHandler.GetFocusRingValueUpperBound = GetFocusRingValueUpperBound;
|
||||||
|
|
||||||
@ -1304,9 +1324,10 @@ T_DjiReturnCode DjiTest_CameraEmuBaseStartService(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//注册相机数字变焦功能
|
||||||
/* Register the camera digital zoom handler */
|
/* Register the camera digital zoom handler */
|
||||||
#if USER_CAMERA_EMU_HYBRID_ZOOM_ON
|
#if USER_CAMERA_EMU_HYBRID_ZOOM_ON
|
||||||
s_digitalZoomHandler.SetDigitalZoomFactor = SetDigitalZoomFactor;
|
s_digitalZoomHandler.SetDigitalZoomFactor = SetDigitalZoomFactor;//设置数字变焦因子
|
||||||
s_digitalZoomHandler.GetDigitalZoomFactor = DjiTest_CameraGetDigitalZoomFactor;
|
s_digitalZoomHandler.GetDigitalZoomFactor = DjiTest_CameraGetDigitalZoomFactor;
|
||||||
|
|
||||||
returnCode = DjiPayloadCamera_RegDigitalZoomHandler(&s_digitalZoomHandler);
|
returnCode = DjiPayloadCamera_RegDigitalZoomHandler(&s_digitalZoomHandler);
|
||||||
@ -1315,12 +1336,13 @@ T_DjiReturnCode DjiTest_CameraEmuBaseStartService(void)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//注册相机光学变焦功能
|
||||||
/* Register the camera optical zoom handler */
|
/* Register the camera optical zoom handler */
|
||||||
s_opticalZoomHandler.SetOpticalZoomFocalLength = SetOpticalZoomFocalLength;
|
s_opticalZoomHandler.SetOpticalZoomFocalLength = SetOpticalZoomFocalLength;//设置光学变焦相机的焦距
|
||||||
s_opticalZoomHandler.GetOpticalZoomFocalLength = GetOpticalZoomFocalLength;
|
s_opticalZoomHandler.GetOpticalZoomFocalLength = GetOpticalZoomFocalLength;
|
||||||
s_opticalZoomHandler.GetOpticalZoomFactor = DjiTest_CameraGetOpticalZoomFactor;
|
s_opticalZoomHandler.GetOpticalZoomFactor = DjiTest_CameraGetOpticalZoomFactor;//获取相机类负载设备的变焦系数
|
||||||
s_opticalZoomHandler.GetOpticalZoomSpec = GetOpticalZoomSpec;
|
s_opticalZoomHandler.GetOpticalZoomSpec = GetOpticalZoomSpec;//获取光学变焦的范围
|
||||||
s_opticalZoomHandler.StartContinuousOpticalZoom = StartContinuousOpticalZoom;
|
s_opticalZoomHandler.StartContinuousOpticalZoom = StartContinuousOpticalZoom;//控制相机类负载设备开始变焦
|
||||||
s_opticalZoomHandler.StopContinuousOpticalZoom = StopContinuousOpticalZoom;
|
s_opticalZoomHandler.StopContinuousOpticalZoom = StopContinuousOpticalZoom;
|
||||||
|
|
||||||
returnCode = DjiPayloadCamera_RegOpticalZoomHandler(&s_opticalZoomHandler);
|
returnCode = DjiPayloadCamera_RegOpticalZoomHandler(&s_opticalZoomHandler);
|
||||||
@ -1330,6 +1352,7 @@ T_DjiReturnCode DjiTest_CameraEmuBaseStartService(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//注册指点变焦功能
|
||||||
/* Register the camera tap zoom handler */
|
/* Register the camera tap zoom handler */
|
||||||
#if USER_CAMERA_EMU_TAP_ZOOM_ON
|
#if USER_CAMERA_EMU_TAP_ZOOM_ON
|
||||||
s_tapZoomHandler.GetTapZoomState = GetTapZoomState;
|
s_tapZoomHandler.GetTapZoomState = GetTapZoomState;
|
||||||
|
@ -44,7 +44,7 @@ T_DjiRunTimeStamps DjiUtilTime_GetRunTimeStamps(void)
|
|||||||
struct rusage rusage;
|
struct rusage rusage;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);//系统的启动时间,不能被设置:https://blog.csdn.net/liu44235/article/details/37692635
|
||||||
timeStamps.realUsec = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
|
timeStamps.realUsec = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
|
||||||
|
|
||||||
getrusage(RUSAGE_SELF, &rusage);
|
getrusage(RUSAGE_SELF, &rusage);
|
||||||
|
Reference in New Issue
Block a user