diff --git a/src/Camera/QGCCameraManager.cc b/src/Camera/QGCCameraManager.cc index 4a55f591b77bd9725017e04dc05a0e1bb873d837..e85a45587ebc03a9dfed658d4a6dc795fde219a9 100644 --- a/src/Camera/QGCCameraManager.cc +++ b/src/Camera/QGCCameraManager.cc @@ -379,6 +379,8 @@ QGCCameraManager::_activeJoystickChanged(Joystick* joystick) qCDebug(CameraManagerLog) << "Joystick changed"; if(_activeJoystick) { disconnect(_activeJoystick, &Joystick::stepZoom, this, &QGCCameraManager::_stepZoom); + disconnect(_activeJoystick, &Joystick::startContinuousZoom, this, &QGCCameraManager::_startZoom); + disconnect(_activeJoystick, &Joystick::stopContinuousZoom, this, &QGCCameraManager::_stopZoom); disconnect(_activeJoystick, &Joystick::stepCamera, this, &QGCCameraManager::_stepCamera); disconnect(_activeJoystick, &Joystick::stepStream, this, &QGCCameraManager::_stepStream); disconnect(_activeJoystick, &Joystick::triggerCamera, this, &QGCCameraManager::_triggerCamera); @@ -388,13 +390,15 @@ QGCCameraManager::_activeJoystickChanged(Joystick* joystick) } _activeJoystick = joystick; if(_activeJoystick) { - connect(_activeJoystick, &Joystick::stepZoom, this, &QGCCameraManager::_stepZoom); - connect(_activeJoystick, &Joystick::stepCamera, this, &QGCCameraManager::_stepCamera); - connect(_activeJoystick, &Joystick::stepStream, this, &QGCCameraManager::_stepStream); - connect(_activeJoystick, &Joystick::triggerCamera, this, &QGCCameraManager::_triggerCamera); - connect(_activeJoystick, &Joystick::startVideoRecord, this, &QGCCameraManager::_startVideoRecording); - connect(_activeJoystick, &Joystick::stopVideoRecord, this, &QGCCameraManager::_stopVideoRecording); - connect(_activeJoystick, &Joystick::toggleVideoRecord, this, &QGCCameraManager::_toggleVideoRecording); + connect(_activeJoystick, &Joystick::stepZoom, this, &QGCCameraManager::_stepZoom); + connect(_activeJoystick, &Joystick::startContinuousZoom, this, &QGCCameraManager::_startZoom); + connect(_activeJoystick, &Joystick::stopContinuousZoom, this, &QGCCameraManager::_stopZoom); + connect(_activeJoystick, &Joystick::stepCamera, this, &QGCCameraManager::_stepCamera); + connect(_activeJoystick, &Joystick::stepStream, this, &QGCCameraManager::_stepStream); + connect(_activeJoystick, &Joystick::triggerCamera, this, &QGCCameraManager::_triggerCamera); + connect(_activeJoystick, &Joystick::startVideoRecord, this, &QGCCameraManager::_startVideoRecording); + connect(_activeJoystick, &Joystick::stopVideoRecord, this, &QGCCameraManager::_stopVideoRecording); + connect(_activeJoystick, &Joystick::toggleVideoRecord, this, &QGCCameraManager::_toggleVideoRecording); } } @@ -442,7 +446,7 @@ QGCCameraManager::_toggleVideoRecording() void QGCCameraManager::_stepZoom(int direction) { - if(_lastZoomChange.elapsed() > 250) { + if(_lastZoomChange.elapsed() > 40) { _lastZoomChange.start(); qCDebug(CameraManagerLog) << "Step Camera Zoom" << direction; QGCCameraControl* pCamera = currentCameraInstance(); @@ -452,6 +456,28 @@ QGCCameraManager::_stepZoom(int direction) } } +//----------------------------------------------------------------------------- +void +QGCCameraManager::_startZoom(int direction) +{ + qCDebug(CameraManagerLog) << "Start Camera Zoom" << direction; + QGCCameraControl* pCamera = currentCameraInstance(); + if(pCamera) { + pCamera->startZoom(direction); + } +} + +//----------------------------------------------------------------------------- +void +QGCCameraManager::_stopZoom() +{ + qCDebug(CameraManagerLog) << "Stop Camera Zoom"; + QGCCameraControl* pCamera = currentCameraInstance(); + if(pCamera) { + pCamera->stopZoom(); + } +} + //----------------------------------------------------------------------------- void QGCCameraManager::_stepCamera(int direction) diff --git a/src/Camera/QGCCameraManager.h b/src/Camera/QGCCameraManager.h index 2c6964f40d75e63704037b1bb250065653ee3f21..e13cf9ab2c55c69e8e224964ab490f17c543fe8b 100644 --- a/src/Camera/QGCCameraManager.h +++ b/src/Camera/QGCCameraManager.h @@ -57,6 +57,8 @@ protected slots: virtual void _mavlinkMessageReceived (const mavlink_message_t& message); virtual void _activeJoystickChanged (Joystick* joystick); virtual void _stepZoom (int direction); + virtual void _startZoom (int direction); + virtual void _stopZoom (); virtual void _stepCamera (int direction); virtual void _stepStream (int direction); virtual void _cameraTimeout ();