diff --git a/src/FlightMap/Widgets/CameraPageWidget.qml b/src/FlightMap/Widgets/CameraPageWidget.qml index c3a889a8e50..a05078c2761 100644 --- a/src/FlightMap/Widgets/CameraPageWidget.qml +++ b/src/FlightMap/Widgets/CameraPageWidget.qml @@ -54,15 +54,6 @@ Column { mainWindow.showComponentDialog(cameraSettings, _cameraVideoMode ? qsTr("Video Settings") : qsTr("Camera Settings"), 70, StandardButton.Ok) } - //-- Dumb camera trigger if no actual camera interface exists - QGCButton { - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Trigger Camera") - visible: !_camera - onClicked: activeVehicle.triggerCamera() - enabled: activeVehicle - objectName: "triggerCameraButton" - } QGCButton { anchors.horizontalCenter: parent.horizontalCenter @@ -248,7 +239,7 @@ Column { } ComboBox { - currentIndex: (activeVehicle._duocamColormap != -1? activeVehicle._duocamColormap : -1) + currentIndex: activeVehicle._duocamColormap visible: !activeVehicle._duocamColormapUpdating model: ListModel { id: cbColormap @@ -355,6 +346,48 @@ Column { } } + Rectangle { + width: parent.width + height: 1 + color: qgcPal.text + } + + QGCLabel { + text: "Capture images (count, interval):" + } + Row { + SpinBox { + id: photoCountBox + value: 1 + } + SpinBox { + id: photoIntervalBox + value: 0 + } + } + + Row { + Column { + QGCButton { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Start") + visible: !_camera + onClicked: activeVehicle.startImageCapture(photoIntervalBox.value, photoCountBox.value) + enabled: activeVehicle + } + } + + Column { + QGCButton { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Stop") + visible: !_camera + onClicked: activeVehicle.stopImageCapture() + enabled: activeVehicle + } + } + } + // Row{ // QGCLabel { // text: "Color palette: " diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 2ceb0bcaf90..30a58c5153b 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -3600,17 +3600,6 @@ void Vehicle::setOfflineEditingDefaultComponentId(int defaultComponentId) void Vehicle::triggerCamera(void) { - QObject *trigCamBut = this->_toolbox->corePlugin()->findChild("triggerCameraButton"); - - if (trigCamBut) - { - qDebug() << "trigCamBut found!"; - trigCamBut->setProperty("color", "red"); - } - else { - qDebug() << "trigCamBut NOT found!"; - } - sendMavCommand(_defaultComponentId, MAV_CMD_DO_DIGICAM_CONTROL, true, // show errors @@ -3620,6 +3609,31 @@ void Vehicle::triggerCamera(void) 1.0); // test shot flag } +void Vehicle::startImageCapture(float interval, float count) +{ + sendMavCommand(_defaultComponentId, + MAV_CMD_IMAGE_START_CAPTURE, + true, // show errors + 0.0, // camera id + interval, + count, + 0.0, + 0.0, + 0.0, + 0.0); +} + +void Vehicle::stopImageCapture(void) +{ + sendMavCommand(_defaultComponentId, + MAV_CMD_IMAGE_STOP_CAPTURE, + true, // show errors + 0.0, 0.0, 0.0, 0.0, + 0.0, + 0.0, + 0.0); +} + void Vehicle::startVideoCapture(void) { sendMavCommand(_defaultComponentId, diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index 2014610aeb1..83bf1d0cac8 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -768,6 +768,8 @@ class Vehicle : public FactGroup Q_INVOKABLE void updateDuocamProperties(void); Q_INVOKABLE void triggerCamera(void); + Q_INVOKABLE void startImageCapture(float interval, float count); + Q_INVOKABLE void stopImageCapture(void); Q_INVOKABLE void startVideoCapture(void); Q_INVOKABLE void stopVideoCapture(void); Q_INVOKABLE void setCameraProperty(QString propertyName, float value);