Browse Source

Merge pull request #3520 from DonLakeFlyer/SensorsSmallScreen

Sensors small screen
QGC4.4
Don Gagne 9 years ago committed by GitHub
parent
commit
87551cf212
  1. 243
      src/AutoPilotPlugins/PX4/SensorsComponent.qml
  2. 2
      src/QmlControls/VehicleRotationCal.qml
  3. 33
      src/comm/MockLink.cc
  4. 1
      src/comm/MockLink.h

243
src/AutoPilotPlugins/PX4/SensorsComponent.qml

@ -36,7 +36,7 @@ QGCView { @@ -36,7 +36,7 @@ QGCView {
readonly property string levelHelp: qsTr("To level the horizon you need to place the vehicle in its level flight position and press OK.")
readonly property string airspeedHelp: qsTr("For Airspeed calibration you will need to keep your airspeed sensor out of any wind and then blow across the sensor.")
readonly property string statusTextAreaDefaultText: qsTr("Start the individual calibration steps by clicking one of the buttons above.")
readonly property string statusTextAreaDefaultText: qsTr("Start the individual calibration steps by clicking one of the buttons to the left.")
// Used to pass what type of calibration is being performed to the preCalibrationDialog
property string preCalibrationDialogType
@ -44,7 +44,7 @@ QGCView { @@ -44,7 +44,7 @@ QGCView {
// Used to pass help text to the preCalibrationDialog dialog
property string preCalibrationDialogHelp
readonly property int rotationColumnWidth: 250
readonly property int rotationColumnWidth: ScreenTools.defaultFontPixelWidth * 30
readonly property var rotations: [
"ROTATION_NONE",
"ROTATION_YAW_45",
@ -114,7 +114,7 @@ QGCView { @@ -114,7 +114,7 @@ QGCView {
onSetCompassRotations: {
if (showCompass0Rot || showCompass1Rot || showCompass2Rot) {
showDialog(compassRotationDialogComponent, qsTr("Set Compass Rotation(s)"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
showDialog(setOrientationsDialogComponent, qsTr("Set Compass Rotation(s)"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
}
}
@ -187,32 +187,55 @@ QGCView { @@ -187,32 +187,55 @@ QGCView {
}
Component {
id: compassRotationDialogComponent
id: setOrientationsDialogComponent
QGCViewDialog {
id: compassRotationDialog
id: setOrientationsDialog
Column {
QGCFlickable {
anchors.fill: parent
contentHeight: columnLayout.height
clip: true
Column {
id: columnLayout
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: compassRotationText
text: boardRotationText
}
Column {
QGCLabel {
text: qsTr("Autopilot Orientation:")
}
FactComboBox {
id: boardRotationCombo
width: rotationColumnWidth;
model: rotations
fact: sens_board_rot
}
}
Column {
// Compass 0 rotation
Component {
id: compass0ComponentLabel
id: compass0ComponentLabel2
QGCLabel {
text: qsTr("External Compass Orientation")
text: qsTr("External Compass Orientation:")
}
}
Component {
id: compass0ComponentCombo
id: compass0ComponentCombo2
FactComboBox {
id: compass0RotationCombo
@ -221,16 +244,23 @@ QGCView { @@ -221,16 +244,23 @@ QGCView {
fact: cal_mag0_rot
}
}
Loader { sourceComponent: showCompass0Rot ? compass0ComponentLabel : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentLabel2 : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null }
}
Column {
// Compass 1 rotation
Component {
id: compass1ComponentLabel
id: compass1ComponentLabel2
QGCLabel { text: qsTr("Compass 1 Orientation") }
QGCLabel {
text: qsTr("External Compass 1 Orientation:")
}
}
Component {
id: compass1ComponentCombo
id: compass1ComponentCombo2
FactComboBox {
id: compass1RotationCombo
@ -239,17 +269,25 @@ QGCView { @@ -239,17 +269,25 @@ QGCView {
fact: cal_mag1_rot
}
}
Loader { sourceComponent: showCompass1Rot ? compass1ComponentLabel : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentLabel2 : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null }
}
Column {
spacing: ScreenTools.defaultFontPixelWidth
// Compass 2 rotation
Component {
id: compass2ComponentLabel
id: compass2ComponentLabel2
QGCLabel { text: qsTr("Compass 2 Orientation") }
QGCLabel {
text: qsTr("Compass 2 Orientation")
}
}
Component {
id: compass2ComponentCombo
id: compass2ComponentCombo2
FactComboBox {
id: compass1RotationCombo
@ -258,26 +296,24 @@ QGCView { @@ -258,26 +296,24 @@ QGCView {
fact: cal_mag2_rot
}
}
Loader { sourceComponent: showCompass2Rot ? compass2ComponentLabel : null }
Loader { sourceComponent: showCompass2Rot ? compass2ComponentCombo : null }
Loader { sourceComponent: showCompass2Rot ? compass2ComponentLabel2 : null }
Loader { sourceComponent: showCompass2Rot ? compass2ComponentCombo2 : null }
}
} // Column
} // QGCFlickable
} // QGCViewDialog
} // Component - compassRotationDialogComponent
} // Component - setOrientationsDialogComponent
QGCViewPanel {
id: panel
anchors.fill: parent
Column {
anchors.fill: parent
id: buttonColumn
spacing: ScreenTools.defaultFontPixelHeight / 2
Row {
readonly property int buttonWidth: ScreenTools.defaultFontPixelWidth * 15
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { text: qsTr("Calibrate:"); anchors.baseline: compassButton.baseline }
IndicatorButton {
id: compassButton
width: parent.buttonWidth
@ -347,23 +383,36 @@ QGCView { @@ -347,23 +383,36 @@ QGCView {
QGCButton {
id: cancelButton
width: parent.buttonWidth
text: qsTr("Cancel")
enabled: false
onClicked: controller.cancelCalibration()
}
QGCButton {
width: parent.buttonWidth
text: qsTr("Set Orientations")
onClicked: showDialog(setOrientationsDialogComponent, qsTr("Set Orientations"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
}
} // Column - Buttons
Item { height: ScreenTools.defaultFontPixelHeight; width: 10 } // spacer
Column {
anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
anchors.left: buttonColumn.right
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
ProgressBar {
id: progressBar
width: parent.width - rotationColumnWidth
anchors.left: parent.left
anchors.right: parent.right
}
Item { height: ScreenTools.defaultFontPixelHeight; width: 10 } // spacer
Item {
property int calDisplayAreaWidth: parent.width - rotationColumnWidth
property int calDisplayAreaWidth: parent.width
width: parent.width
height: parent.height - y
@ -402,12 +451,19 @@ QGCView { @@ -402,12 +451,19 @@ QGCView {
Flow {
anchors.topMargin: ScreenTools.defaultFontPixelWidth
anchors.top: orientationCalAreaHelpText.bottom
anchors.left: orientationCalAreaHelpText.left
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: parent.height - orientationCalAreaHelpText.implicitHeight
spacing: ScreenTools.defaultFontPixelWidth
spacing: ScreenTools.defaultFontPixelWidth / 2
property real indicatorWidth: (width / 3) - (spacing * 2)
property real indicatorHeight: (height / 2) - spacing
VehicleRotationCal {
width: parent.indicatorWidth
height: parent.indicatorHeight
visible: controller.orientationCalDownSideVisible
calValid: controller.orientationCalDownSideDone
calInProgress: controller.orientationCalDownSideInProgress
@ -415,6 +471,8 @@ QGCView { @@ -415,6 +471,8 @@ QGCView {
imageSource: controller.orientationCalDownSideRotate ? "qrc:///qmlimages/VehicleDownRotate.png" : "qrc:///qmlimages/VehicleDown.png"
}
VehicleRotationCal {
width: parent.indicatorWidth
height: parent.indicatorHeight
visible: controller.orientationCalUpsideDownSideVisible
calValid: controller.orientationCalUpsideDownSideDone
calInProgress: controller.orientationCalUpsideDownSideInProgress
@ -422,6 +480,8 @@ QGCView { @@ -422,6 +480,8 @@ QGCView {
imageSource: controller.orientationCalUpsideDownSideRotate ? "qrc:///qmlimages/VehicleUpsideDownRotate.png" : "qrc:///qmlimages/VehicleUpsideDown.png"
}
VehicleRotationCal {
width: parent.indicatorWidth
height: parent.indicatorHeight
visible: controller.orientationCalNoseDownSideVisible
calValid: controller.orientationCalNoseDownSideDone
calInProgress: controller.orientationCalNoseDownSideInProgress
@ -429,6 +489,8 @@ QGCView { @@ -429,6 +489,8 @@ QGCView {
imageSource: controller.orientationCalNoseDownSideRotate ? "qrc:///qmlimages/VehicleNoseDownRotate.png" : "qrc:///qmlimages/VehicleNoseDown.png"
}
VehicleRotationCal {
width: parent.indicatorWidth
height: parent.indicatorHeight
visible: controller.orientationCalTailDownSideVisible
calValid: controller.orientationCalTailDownSideDone
calInProgress: controller.orientationCalTailDownSideInProgress
@ -436,6 +498,8 @@ QGCView { @@ -436,6 +498,8 @@ QGCView {
imageSource: controller.orientationCalTailDownSideRotate ? "qrc:///qmlimages/VehicleTailDownRotate.png" : "qrc:///qmlimages/VehicleTailDown.png"
}
VehicleRotationCal {
width: parent.indicatorWidth
height: parent.indicatorHeight
visible: controller.orientationCalLeftSideVisible
calValid: controller.orientationCalLeftSideDone
calInProgress: controller.orientationCalLeftSideInProgress
@ -443,6 +507,8 @@ QGCView { @@ -443,6 +507,8 @@ QGCView {
imageSource: controller.orientationCalLeftSideRotate ? "qrc:///qmlimages/VehicleLeftRotate.png" : "qrc:///qmlimages/VehicleLeft.png"
}
VehicleRotationCal {
width: parent.indicatorWidth
height: parent.indicatorHeight
visible: controller.orientationCalRightSideVisible
calValid: controller.orientationCalRightSideDone
calInProgress: controller.orientationCalRightSideInProgress
@ -451,113 +517,6 @@ QGCView { @@ -451,113 +517,6 @@ QGCView {
}
}
}
Column {
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: orientationCalArea.right
x: parent.width - rotationColumnWidth
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
font.pointSize: ScreenTools.mediumFontPointSize
text: qsTr("Set Orientations")
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: boardRotationText
}
Column {
QGCLabel {
text: qsTr("Autpilot Orientation:")
}
FactComboBox {
id: boardRotationCombo
width: rotationColumnWidth;
model: rotations
fact: sens_board_rot
}
}
Column {
// Compass 0 rotation
Component {
id: compass0ComponentLabel2
QGCLabel {
text: qsTr("External Compass Orientation:")
}
}
Component {
id: compass0ComponentCombo2
FactComboBox {
id: compass0RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag0_rot
}
}
Loader { sourceComponent: showCompass0Rot ? compass0ComponentLabel2 : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null }
}
Column {
// Compass 1 rotation
Component {
id: compass1ComponentLabel2
QGCLabel {
text: qsTr("External Compass 1 Orientation:")
}
}
Component {
id: compass1ComponentCombo2
FactComboBox {
id: compass1RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag1_rot
}
}
Loader { sourceComponent: showCompass1Rot ? compass1ComponentLabel2 : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null }
}
Column {
spacing: ScreenTools.defaultFontPixelWidth
// Compass 2 rotation
Component {
id: compass2ComponentLabel2
QGCLabel {
text: qsTr("Compass 2 Orientation")
}
}
Component {
id: compass2ComponentCombo2
FactComboBox {
id: compass1RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag2_rot
}
}
Loader { sourceComponent: showCompass2Rot ? compass2ComponentLabel2 : null }
Loader { sourceComponent: showCompass2Rot ? compass2ComponentCombo2 : null }
}
}
}
}
} // QGCViewPanel

2
src/QmlControls/VehicleRotationCal.qml

@ -30,8 +30,6 @@ Rectangle { @@ -30,8 +30,6 @@ Rectangle {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
width: 200
height: 200
color: calInProgress ? "yellow" : (calValid ? "green" : "red")
Rectangle {

33
src/comm/MockLink.cc

@ -791,6 +791,9 @@ void MockLink::_handleCommandLong(const mavlink_message_t& msg) @@ -791,6 +791,9 @@ void MockLink::_handleCommandLong(const mavlink_message_t& msg)
commandResult = MAV_RESULT_ACCEPTED;
break;
case MAV_CMD_PREFLIGHT_CALIBRATION:
_handlePreFlightCalibration(request);
commandResult = MAV_RESULT_ACCEPTED;
break;
case MAV_CMD_PREFLIGHT_STORAGE:
commandResult = MAV_RESULT_ACCEPTED;
break;
@ -1053,3 +1056,33 @@ void MockLink::_sendRCChannels(void) @@ -1053,3 +1056,33 @@ void MockLink::_sendRCChannels(void)
respondWithMavlinkMessage(msg);
}
void MockLink::_handlePreFlightCalibration(const mavlink_command_long_t& request)
{
const char* pCalMessage;
static const char* gyroCalResponse = "[cal] calibration started: 2 gyro";
static const char* magCalResponse = "[cal] calibration started: 2 mag";
static const char* accelCalResponse = "[cal] calibration started: 2 accel";
if (request.param1 == 1) {
// Gyro cal
pCalMessage = gyroCalResponse;
} else if (request.param2 == 1) {
// Mag cal
pCalMessage = magCalResponse;
} else if (request.param5 == 1) {
// Accel cal
pCalMessage = accelCalResponse;
} else {
return;
}
mavlink_message_t msg;
mavlink_msg_statustext_pack(_vehicleSystemId,
_vehicleComponentId,
&msg,
MAV_SEVERITY_INFO,
pCalMessage);
respondWithMavlinkMessage(msg);
}

1
src/comm/MockLink.h

@ -166,6 +166,7 @@ private: @@ -166,6 +166,7 @@ private:
void _handleFTP(const mavlink_message_t& msg);
void _handleCommandLong(const mavlink_message_t& msg);
void _handleManualControl(const mavlink_message_t& msg);
void _handlePreFlightCalibration(const mavlink_command_long_t& request);
float _floatUnionForParam(int componentId, const QString& paramName);
void _setParamFloatUnionIntoMap(int componentId, const QString& paramName, float paramFloat);
void _sendHomePosition(void);

Loading…
Cancel
Save