From 22166a11574c66fe691ea4f7d8270c95dfdcc3b0 Mon Sep 17 00:00:00 2001 From: Stefan Dunca Date: Tue, 30 Jul 2019 22:46:31 +0200 Subject: [PATCH] Custom Example: Fix gimbal state getting out of the limits. Fix palette button not working if not in thermal mode. Increase zoom buttons --- custom-example/res/CustomCameraControl.qml | 18 +++++++++++------- custom-example/res/CustomFlyView.qml | 7 +++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/custom-example/res/CustomCameraControl.qml b/custom-example/res/CustomCameraControl.qml index be0052a..38a0ee2 100644 --- a/custom-example/res/CustomCameraControl.qml +++ b/custom-example/res/CustomCameraControl.qml @@ -85,7 +85,7 @@ Item { //--------------------------------------------------------------------- //-- Quick Thermal Modes Item { - id: backgroundRect + id: thermalBackgroundRect width: buttonsRow.width + (ScreenTools.defaultFontPixelWidth * 4) height: buttonsRow.height + (ScreenTools.defaultFontPixelHeight) visible: _irPaletteFact && QGroundControl.videoManager.hasThermal || _camera.vendor === "NextVision" @@ -143,14 +143,12 @@ Item { // Thermal palette options CustomQuickButton { checkable: false - enabled: thermalFull.checked || thermalPip.checked width: buttonSize height: buttonSize + visible: _irPaletteFact iconSource: "/custom/img/thermal-palette.svg" onClicked: { - if(_irPaletteFact) { - thermalPalettes.open() - } + thermalPalettes.open() } } } @@ -466,7 +464,7 @@ Item { visible: _hasZoom mainColor: qgcPal.window contentColor: qgcPal.text - fontPointSize: ScreenTools.defaultFontPointSize * 1.25 + fontPointSize: ScreenTools.defaultFontPointSize * 1.75 zoomLevelVisible: false zoomLevel: _hasZoom ? _camera.zoomLevel : NaN anchors.horizontalCenter: parent.horizontalCenter @@ -942,7 +940,7 @@ Item { id: thermalPalettes width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40) height: mainWindow.height * 0.5 - modal: true + //modal: true focus: true parent: Overlay.overlay x: Math.round((mainWindow.width - width) * 0.5) @@ -980,6 +978,12 @@ Item { anchors.horizontalCenter: parent.horizontalCenter onClicked: { _irPaletteFact.value = index + if(thermalBackgroundRect.visible) { + if(_camera.thermalMode !== QGCCameraControl.THERMAL_PIP && _camera.thermalMode !== QGCCameraControl.THERMAL_FULL) { + _camera.thermalMode = QGCCameraControl.THERMAL_FULL + } + } + thermalPalettes.close() } } diff --git a/custom-example/res/CustomFlyView.qml b/custom-example/res/CustomFlyView.qml index 940f841..36c94b8 100644 --- a/custom-example/res/CustomFlyView.qml +++ b/custom-example/res/CustomFlyView.qml @@ -563,8 +563,11 @@ Item { //console.info("error: " + pitch_angle_error + "; angle_state: " + pitch_angle) pitch = pitch_setpoint yaw += stick.xAxis * gimbalControl.speedMultiplier + yaw = clamp(yaw, -180, 180) - pitch = clamp(pitch, -45, 45) + pitch = clamp(pitch, -90, 45) + pitch_angle = clamp(pitch_angle, -90, 45) + //console.info("P: " + pitch + "; Y: " + yaw) activeVehicle.gimbalControlValue(pitch, yaw); gimbalControl._currentYaw = yaw @@ -572,7 +575,7 @@ Item { gimbalControl.time_last_seconds = time_current_seconds } else { yaw += stick.xAxis * gimbalControl.speedMultiplier - var hackedYaw = yaw + (stick.xAxis * gimbalControl.speedMultiplier * 25) + var hackedYaw = yaw + (stick.xAxis * gimbalControl.speedMultiplier * 50) pitch += pitch_stick * gimbalControl.speedMultiplier hackedYaw = clamp(hackedYaw, -180, 180) yaw = clamp(yaw, -180, 180)