Commit 2e816711 authored by Don Gagne's avatar Don Gagne

Merge pull request #3497 from DonLakeFlyer/SimpleFlightModeSmallScreen

Simple flight mode small screen
parents 06520510 c2544df7
......@@ -27,8 +27,8 @@ Item {
property real _margins: ScreenTools.defaultFontPixelHeight / 2
readonly property real _flightModeComboWidth: ScreenTools.defaultFontPixelWidth * 23
readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 20
readonly property real _flightModeComboWidth: ScreenTools.defaultFontPixelWidth * 13
readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 13
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
......@@ -80,7 +80,7 @@ Item {
QGCLabel {
id: modeChannelLabel
anchors.baseline: modeChannelCombo.baseline
text: qsTr("Flight mode channel:")
text: qsTr("Mode channel:")
}
FactComboBox {
......@@ -139,28 +139,62 @@ Item {
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelHeight
Repeater {
model: [ "RC_MAP_RETURN_SW", "RC_MAP_KILL_SW", "RC_MAP_OFFB_SW" ]
Row {
spacing: ScreenTools.defaultFontPixelWidth
Row {
spacing: ScreenTools.defaultFontPixelWidth
property Fact fact: controller.getParameterFact(-1, "RC_MAP_RETURN_SW")
property Fact fact: controller.getParameterFact(-1, modelData)
QGCLabel {
anchors.baseline: returnCombo.baseline
text: "Return switch:"
color: fact.value == 0 ? qgcPal.text : (controller.rcChannelValues[fact.value - 1] >= 1500 ? "yellow" : qgcPal.text)
}
QGCLabel {
anchors.baseline: optCombo.baseline
text: fact.shortDescription + ":"
color: fact.value == 0 ? qgcPal.text : (controller.rcChannelValues[fact.value - 1] >= 1500 ? "yellow" : qgcPal.text)
}
FactComboBox {
id: returnCombo
width: _channelComboWidth
fact: parent.fact
indexModel: false
}
}
FactComboBox {
id: optCombo
width: _channelComboWidth
fact: parent.fact
indexModel: false
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
property Fact fact: controller.getParameterFact(-1, "RC_MAP_KILL_SW")
QGCLabel {
anchors.baseline: killCombo.baseline
text: "Kill switch:"
color: fact.value == 0 ? qgcPal.text : (controller.rcChannelValues[fact.value - 1] >= 1500 ? "yellow" : qgcPal.text)
}
FactComboBox {
id: killCombo
width: _channelComboWidth
fact: parent.fact
indexModel: false
}
} // Repeater
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
property Fact fact: controller.getParameterFact(-1, "RC_MAP_OFFB_SW")
QGCLabel {
anchors.baseline: offboardCombo.baseline
text: "Offboard switch:"
color: fact.value == 0 ? qgcPal.text : (controller.rcChannelValues[fact.value - 1] >= 1500 ? "yellow" : qgcPal.text)
}
FactComboBox {
id: offboardCombo
width: _channelComboWidth
fact: parent.fact
indexModel: false
}
}
} // Column
} // Rectangle
......
......@@ -158,6 +158,10 @@ void MockLink::_run1HzTasks(void)
if (_mavlinkStarted && _connected) {
_sendHeartBeat();
_sendVibration();
if (!qgcApp()->runningUnitTests()) {
// Sending RC Channels during unit test breaks RC tests which does it's own RC simulation
_sendRCChannels();
}
if (_sendHomePositionDelayCount > 0) {
// We delay home position a bit to be more realistic
_sendHomePositionDelayCount--;
......@@ -1026,3 +1030,26 @@ MockLink* MockLink::startAPMArduPlaneMockLink(bool sendStatusText)
return _startMockLink(mockConfig);
}
void MockLink::_sendRCChannels(void)
{
mavlink_message_t msg;
mavlink_msg_rc_channels_pack(_vehicleSystemId,
_vehicleComponentId,
&msg,
0, // time_boot_ms
8, // chancount
1500, // chan1_raw
1500, // chan2_raw
1500, // chan3_raw
1500, // chan4_raw
1500, // chan5_raw
1500, // chan6_raw
1500, // chan7_raw
1500, // chan8_raw
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
0); // rssi
respondWithMavlinkMessage(msg);
}
......@@ -173,6 +173,7 @@ private:
void _sendVibration(void);
void _sendStatusTextMessages(void);
void _respondWithAutopilotVersion(void);
void _sendRCChannels(void);
static MockLink* _startMockLink(MockConfiguration* mockConfig);
......
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