@ -31,91 +31,101 @@ import QGroundControl.FactControls 1.0
@@ -31,91 +31,101 @@ import QGroundControl.FactControls 1.0
import QGroundControl . Palette 1.0
import QGroundControl . Controls 1.0
import QGroundControl . ScreenTools 1.0
import QGroundControl . Controllers 1.0
QGCView {
id: rootQGCView
viewComponent: view
/ / H e l p t e x t w h i c h i s s h o w n b o t h i n t h e s t a t u s t e x t a r e a p r i o r t o p r e s s i n g a c a l b u t t o n a n d i n t h e
/ / p r e - c a l i b r a t i o n d i a l o g .
readonly property string compassHelp: "For Compass calibration you will need to rotate your vehicle through a number of positions. For this calibration is is best " +
"to be connected to your vehicle via radio instead of USB since the USB cable will likely get in the way."
readonly property string gyroHelp: "For Gyroscope calibration you will need to place your vehicle right side up on solid surface and leave it still."
readonly property string accelHelp: "For Accelerometer calibration you will need to place your vehicle on all six sides and hold it still there for a few seconds."
readonly property string airspeedHelp: "For Airspeed calibration you will need to keep your airspeed sensor out of any wind and then blow across the sensor."
property var controller
/ / U s e d t o p a s s w h a t t y p e o f c a l i b r a t i o n i s b e i n g p e r f o r m e d t o t h e p r e C a l i b r a t i o n D i a l o g
property string preCalibrationDialogType
/ / U s e d t o p a s s h e l p t e x t t o t h e p r e C a l i b r a t i o n D i a l o g d i a l o g
property string preCalibrationDialogHelp
readonly property int rotationColumnWidth: 200
readonly property var rotations: [
"ROTATION_NONE" ,
"ROTATION_YAW_45" ,
"ROTATION_YAW_90" ,
"ROTATION_YAW_135" ,
"ROTATION_YAW_180" ,
"ROTATION_YAW_225" ,
"ROTATION_YAW_270" ,
"ROTATION_YAW_315" ,
"ROTATION_ROLL_180" ,
"ROTATION_ROLL_180_YAW_45" ,
"ROTATION_ROLL_180_YAW_90" ,
"ROTATION_ROLL_180_YAW_135" ,
"ROTATION_PITCH_180" ,
"ROTATION_ROLL_180_YAW_225" ,
"ROTATION_ROLL_180_YAW_270" ,
"ROTATION_ROLL_180_YAW_315" ,
"ROTATION_ROLL_90" ,
"ROTATION_ROLL_90_YAW_45" ,
"ROTATION_ROLL_90_YAW_90" ,
"ROTATION_ROLL_90_YAW_135" ,
"ROTATION_ROLL_270" ,
"ROTATION_ROLL_270_YAW_45" ,
"ROTATION_ROLL_270_YAW_90" ,
"ROTATION_ROLL_270_YAW_135" ,
"ROTATION_PITCH_90" ,
"ROTATION_PITCH_270" ,
"ROTATION_ROLL_270_YAW_270"
]
Component {
id: preCalibrationDialogComponent
QGCViewDialog {
id: preCalibrationDialog
Fact { id: sys_autostart ; name: "SYS_AUTOSTART" }
function accept ( ) {
sys_autostart . value = 0
customConfigDialog . hideDialog ( )
}
QGCLabel {
anchors.fill: parent
wrapMode: Text . WordWrap
text: "Your vehicle is using a custom airframe configuration. " +
"This configuration can only be modified through the Parameter Editor.\n\n" +
"If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above."
if ( preCalibrationDialogType == "gyro" ) {
controller . calibrateGyro ( )
} else if ( preCalibrationDialogType == "accel" ) {
controller . calibrateAccel ( )
} else if ( preCalibrationDialogType == "compass" ) {
controller . calibrateCompass ( )
} else if ( preCalibrationDialogType == "airspeed" ) {
controller . calibrateAirspeed ( )
}
preCalibrationDialog . hideDialog ( )
}
Rectangle {
property string calibrationType
id: boardRotationOverlay
width: 300
height: boardRotationOverlayColumn . height + 11
anchors.verticalCenter: parent . verticalCenter
anchors.horizontalCenter: parent . horizontalCenter
color: qgcPal . window
border.width: 1
border.color: qgcPal . text
visible: false
z: overlay . z + 1
Column {
id: boardRotationOverlayColumn
anchors.topMargin: 10
anchors.top: parent . top
width: parent . width
spacing: 10
Column {
anchors.leftMargin: 10
anchors.rightMargin: 10
anchors.left: parent . left
anchors.right: parent . right
spacing: 10
QGCLabel {
width: parent . width
wrapMode: Text . WordWrap
text: "Please check and/or update board rotation before calibrating"
}
FactComboBox {
width: rotationColumnWidth
model: rotations
fact: Fact { name: "SENS_BOARD_ROT" }
}
}
Column {
anchors.fill: parent
spacing: 10
QGCButton {
x: 1
width: parent . width - 2
primary: true
text: "OK"
QGCLabel {
width: parent . width
wrapMode: Text . WordWrap
text: preCalibrationDialogHelp
}
onClicked: {
boardRotationOverlay . visible = false
overlay . visible = false
QGCLabel {
width: parent . width
wrapMode: Text . WordWrap
visible: preCalibrationDialogType != "airspeed"
text: "Please check and/or update board rotation before calibrating"
}
if ( boardRotationOverlay . calibrationType == "gyro" ) {
controller . calibrateGyro ( )
} else if ( boardRotationOverlay . calibrationType == "accel" ) {
controller . calibrateAccel ( )
} else if ( boardRotationOverlay . calibrationType == "compass" ) {
controller . calibrateCompass ( )
}
}
}
FactComboBox {
width: rotationColumnWidth
model: rotations
visible: preCalibrationDialogType != "airspeed"
fact: Fact { name: "SENS_BOARD_ROT" ; onFactMissing: showMissingFactOverlay ( name ) }
}
}
}
@ -124,42 +134,44 @@ QGCView {
@@ -124,42 +134,44 @@ QGCView {
Component {
id: view
/ / F I X M E : N e e d t o c o n v e r t Q G C V i e w P a n e l t o F a c t P a n e l
QGCViewPanel {
anchors.fill: parent
id: viewPanel
Connections {
target: rootQGCView
onCompleted: {
rootQGCView . controller = viewPanel . controller
}
}
SensorsComponentController {
id: controller
factPanel: viewPanel
statusLog: statusTextArea
progressBar: progressBar
compassButton: compassButton
gyroButton: gyroButton
accelButton: accelButton
airspeedButton: airspeedButton
cancelButton: cancelButton
orientationCalAreaHelpText: orientationCalAreaHelpText
onResetStatusTextArea: statusTextArea . text = statusTextAreaDefaultText
onSetCompassRotations: showCompassRotationOverlay ( )
onWaitingForCancelChanged: {
if ( controller . waitingForCancel ) {
showMessage (
} else {
hideDialog ( )
}
}
}
QGCPalette { id: qgcPal ; colorGroupEnabled: enabled }
readonly property int rotationColumnWidth: 200
readonly property var rotations: [
"ROTATION_NONE" ,
"ROTATION_YAW_45" ,
"ROTATION_YAW_90" ,
"ROTATION_YAW_135" ,
"ROTATION_YAW_180" ,
"ROTATION_YAW_225" ,
"ROTATION_YAW_270" ,
"ROTATION_YAW_315" ,
"ROTATION_ROLL_180" ,
"ROTATION_ROLL_180_YAW_45" ,
"ROTATION_ROLL_180_YAW_90" ,
"ROTATION_ROLL_180_YAW_135" ,
"ROTATION_PITCH_180" ,
"ROTATION_ROLL_180_YAW_225" ,
"ROTATION_ROLL_180_YAW_270" ,
"ROTATION_ROLL_180_YAW_315" ,
"ROTATION_ROLL_90" ,
"ROTATION_ROLL_90_YAW_45" ,
"ROTATION_ROLL_90_YAW_90" ,
"ROTATION_ROLL_90_YAW_135" ,
"ROTATION_ROLL_270" ,
"ROTATION_ROLL_270_YAW_45" ,
"ROTATION_ROLL_270_YAW_90" ,
"ROTATION_ROLL_270_YAW_135" ,
"ROTATION_PITCH_90" ,
"ROTATION_PITCH_270" ,
"ROTATION_ROLL_270_YAW_270"
]
readonly property string statusTextAreaDefaultText: "For Compass calibration you will need to rotate your vehicle through a number of positions. For this calibration is is best " +
"to be connected to your vehicle via radio instead of USB since the USB cable will likely get in the way.\n\n" +
@ -181,33 +193,6 @@ QGCView {
@@ -181,33 +193,6 @@ QGCView {
color: qgcPal . window
/ / W e u s e t h i s b o g u s l o a d e r j u s t s o w e c a n g e t a n o n L o a d e d s i g n a l t o h o o k t o i n o r d e r t o
/ / f i n i s h c o n t r o l l e r i n i t i a l i z a t i o n .
Component {
id: loadSignal ;
Item { }
}
Loader {
sourceComponent: loadSignal
onLoaded: {
controller . statusLog = statusTextArea
controller . progressBar = progressBar
controller . compassButton = compassButton
controller . gyroButton = gyroButton
controller . accelButton = accelButton
controller . airspeedButton = airspeedButton
controller . cancelButton = cancelButton
controller . orientationCalAreaHelpText = orientationCalAreaHelpText
}
}
Connections {
target: controller
onResetStatusTextArea: statusTextArea . text = statusTextAreaDefaultText
onSetCompassRotations: showCompassRotationOverlay ( )
}
Rectangle {
id: overlay
anchors.fill: parent
@ -383,7 +368,11 @@ QGCView {
@@ -383,7 +368,11 @@ QGCView {
text: "Compass"
indicatorGreen: fact . value != 0
onClicked: showBoardRotationOverlay ( "compass" )
onClicked: {
preCalibrationDialogType = "compass"
preCalibrationDialogHelp = compassHelp
showDialog ( preCalibrationDialogComponent , "Calibrate Compass" , 50 , StandardButton . Cancel | StandardButton . Ok )
}
}
IndicatorButton {
@ -394,7 +383,11 @@ QGCView {
@@ -394,7 +383,11 @@ QGCView {
text: "Gyroscope"
indicatorGreen: fact . value != 0
onClicked: showBoardRotationOverlay ( "gyro" )
onClicked: {
preCalibrationDialogType = "gyro"
preCalibrationDialogHelp = gyroHelp
showDialog ( preCalibrationDialogComponent , "Calibrate Gyro" , 50 , StandardButton . Cancel | StandardButton . Ok )
}
}
IndicatorButton {
@ -405,7 +398,11 @@ QGCView {
@@ -405,7 +398,11 @@ QGCView {
text: "Accelerometer"
indicatorGreen: fact . value != 0
onClicked: showBoardRotationOverlay ( "accel" )
onClicked: {
preCalibrationDialogType = "accel"
preCalibrationDialogHelp = accelHelp
showDialog ( preCalibrationDialogComponent , "Calibrate Accelerometer" , 50 , StandardButton . Cancel | StandardButton . Ok )
}
}
IndicatorButton {
@ -416,7 +413,12 @@ QGCView {
@@ -416,7 +413,12 @@ QGCView {
text: "Airspeed"
visible: controller . fixedWing
indicatorGreen: fact . value != 0
onClicked: controller . calibrateAirspeed ( )
onClicked: {
preCalibrationDialogType = "airspeed"
preCalibrationDialogHelp = airspeedHelp
showDialog ( preCalibrationDialogComponent , "Calibrate Airspeed" , 50 , StandardButton . Cancel | StandardButton . Ok )
}
}
QGCButton {