Unverified Commit 2de904b7 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #7648 from stefandunca/pr-small_improvements

Custom Example: Minor fixes for custom build controls
parents 0720c373 22166a11
...@@ -85,7 +85,7 @@ Item { ...@@ -85,7 +85,7 @@ Item {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//-- Quick Thermal Modes //-- Quick Thermal Modes
Item { Item {
id: backgroundRect id: thermalBackgroundRect
width: buttonsRow.width + (ScreenTools.defaultFontPixelWidth * 4) width: buttonsRow.width + (ScreenTools.defaultFontPixelWidth * 4)
height: buttonsRow.height + (ScreenTools.defaultFontPixelHeight) height: buttonsRow.height + (ScreenTools.defaultFontPixelHeight)
visible: _irPaletteFact && (QGroundControl.videoManager.hasThermal || _camera.vendor === "NextVision") visible: _irPaletteFact && (QGroundControl.videoManager.hasThermal || _camera.vendor === "NextVision")
...@@ -143,14 +143,12 @@ Item { ...@@ -143,14 +143,12 @@ Item {
// Thermal palette options // Thermal palette options
CustomQuickButton { CustomQuickButton {
checkable: false checkable: false
enabled: thermalFull.checked || thermalPip.checked
width: buttonSize width: buttonSize
height: buttonSize height: buttonSize
visible: _irPaletteFact
iconSource: "/custom/img/thermal-palette.svg" iconSource: "/custom/img/thermal-palette.svg"
onClicked: { onClicked: {
if(_irPaletteFact) { thermalPalettes.open()
thermalPalettes.open()
}
} }
} }
} }
...@@ -466,7 +464,7 @@ Item { ...@@ -466,7 +464,7 @@ Item {
visible: _hasZoom visible: _hasZoom
mainColor: qgcPal.window mainColor: qgcPal.window
contentColor: qgcPal.text contentColor: qgcPal.text
fontPointSize: ScreenTools.defaultFontPointSize * 1.25 fontPointSize: ScreenTools.defaultFontPointSize * 1.75
zoomLevelVisible: false zoomLevelVisible: false
zoomLevel: _hasZoom ? _camera.zoomLevel : NaN zoomLevel: _hasZoom ? _camera.zoomLevel : NaN
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
...@@ -942,7 +940,7 @@ Item { ...@@ -942,7 +940,7 @@ Item {
id: thermalPalettes id: thermalPalettes
width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40) width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40)
height: mainWindow.height * 0.5 height: mainWindow.height * 0.5
modal: true //modal: true
focus: true focus: true
parent: Overlay.overlay parent: Overlay.overlay
x: Math.round((mainWindow.width - width) * 0.5) x: Math.round((mainWindow.width - width) * 0.5)
...@@ -986,6 +984,12 @@ Item { ...@@ -986,6 +984,12 @@ Item {
checked: index === _irPaletteFact.value checked: index === _irPaletteFact.value
onClicked: { onClicked: {
_irPaletteFact.value = index _irPaletteFact.value = index
if(thermalBackgroundRect.visible) {
if(_camera.thermalMode !== QGCCameraControl.THERMAL_PIP && _camera.thermalMode !== QGCCameraControl.THERMAL_FULL) {
_camera.thermalMode = QGCCameraControl.THERMAL_FULL
}
}
thermalPalettes.close() thermalPalettes.close()
} }
} }
......
...@@ -563,8 +563,11 @@ Item { ...@@ -563,8 +563,11 @@ Item {
//console.info("error: " + pitch_angle_error + "; angle_state: " + pitch_angle) //console.info("error: " + pitch_angle_error + "; angle_state: " + pitch_angle)
pitch = pitch_setpoint pitch = pitch_setpoint
yaw += stick.xAxis * gimbalControl.speedMultiplier yaw += stick.xAxis * gimbalControl.speedMultiplier
yaw = clamp(yaw, -180, 180) 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) //console.info("P: " + pitch + "; Y: " + yaw)
activeVehicle.gimbalControlValue(pitch, yaw); activeVehicle.gimbalControlValue(pitch, yaw);
gimbalControl._currentYaw = yaw gimbalControl._currentYaw = yaw
...@@ -572,7 +575,7 @@ Item { ...@@ -572,7 +575,7 @@ Item {
gimbalControl.time_last_seconds = time_current_seconds gimbalControl.time_last_seconds = time_current_seconds
} else { } else {
yaw += stick.xAxis * gimbalControl.speedMultiplier 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 pitch += pitch_stick * gimbalControl.speedMultiplier
hackedYaw = clamp(hackedYaw, -180, 180) hackedYaw = clamp(hackedYaw, -180, 180)
yaw = clamp(yaw, -180, 180) yaw = clamp(yaw, -180, 180)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment