Commit 848b864d authored by Don Gagne's avatar Don Gagne

Merge pull request #2504 from DonLakeFlyer/ArmingChecks

Arming checks added to Safety
parents fb04b233 3d66fe06
...@@ -58,6 +58,8 @@ QGCView { ...@@ -58,6 +58,8 @@ QGCView {
property Fact _rtlLoitTimeFact: controller.getParameterFact(-1, "RTL_LOIT_TIME") property Fact _rtlLoitTimeFact: controller.getParameterFact(-1, "RTL_LOIT_TIME")
property Fact _rtlAltFinalFact: controller.getParameterFact(-1, "RTL_ALT_FINAL") property Fact _rtlAltFinalFact: controller.getParameterFact(-1, "RTL_ALT_FINAL")
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
property real _margins: ScreenTools.defaultFontPixelHeight property real _margins: ScreenTools.defaultFontPixelHeight
ExclusiveGroup { id: fenceActionRadioGroup } ExclusiveGroup { id: fenceActionRadioGroup }
...@@ -71,9 +73,8 @@ QGCView { ...@@ -71,9 +73,8 @@ QGCView {
Flickable { Flickable {
clip: true clip: true
anchors.fill: parent anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds contentHeight: armingCheckSettings.y + armingCheckSettings.height
contentHeight: rtlSettings.y + rtlSettings.height contentWidth: armingCheckSettings.x + armingCheckSettings.width
flickableDirection: Flickable.VerticalFlick
QGCLabel { QGCLabel {
id: failsafeLabel id: failsafeLabel
...@@ -447,6 +448,33 @@ QGCView { ...@@ -447,6 +448,33 @@ QGCView {
showUnits: true showUnits: true
} }
} // Rectangle - RTL Settings } // Rectangle - RTL Settings
QGCLabel {
id: armingCheckLabel
anchors.topMargin: _margins
anchors.left: parent.left
anchors.top: rtlSettings.bottom
text: "Arming Checks"
font.weight: Font.DemiBold
}
Rectangle {
id: armingCheckSettings
anchors.topMargin: _margins / 2
anchors.left: parent.left
anchors.top: armingCheckLabel.bottom
width: armingCheckColumn.x + armingCheckColumn.width + _margins
height: armingCheckColumn.y + armingCheckColumn.height + _margins
color: palette.windowShade
Column {
id: armingCheckColumn
spacing: _margins
QGCLabel { text: "Be very careful when turning off arming checks. Could lead to loss of Vehicle control." }
FactBitmask { fact: _armingCheck }
}
}
} // Flickable } // Flickable
} // QGCViewPanel } // QGCViewPanel
} // QGCView } // QGCView
...@@ -26,6 +26,8 @@ FactPanel { ...@@ -26,6 +26,8 @@ FactPanel {
property Fact _rtlAltFinalFact: controller.getParameterFact(-1, "RTL_ALT_FINAL") property Fact _rtlAltFinalFact: controller.getParameterFact(-1, "RTL_ALT_FINAL")
property Fact _landSpeedFact: controller.getParameterFact(-1, "LAND_SPEED") property Fact _landSpeedFact: controller.getParameterFact(-1, "LAND_SPEED")
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
property string _failsafeBattEnableText property string _failsafeBattEnableText
property string _failsafeThrEnableText property string _failsafeThrEnableText
...@@ -85,6 +87,11 @@ FactPanel { ...@@ -85,6 +87,11 @@ FactPanel {
anchors.fill: parent anchors.fill: parent
anchors.margins: 8 anchors.margins: 8
VehicleSummaryRow {
labelText: "Arming Checks:"
valueText: _armingCheck.value & 1 ? "Enabled" : "Some disabled"
}
VehicleSummaryRow { VehicleSummaryRow {
labelText: "Throttle failsafe:" labelText: "Throttle failsafe:"
valueText: _failsafeThrEnableText valueText: _failsafeThrEnableText
......
...@@ -523,21 +523,51 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType) ...@@ -523,21 +523,51 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
bool ok = false; bool ok = false;
unsigned int bitSet = bitmaskPair.first.toUInt(&ok); unsigned int bitSet = bitmaskPair.first.toUInt(&ok);
bitSet = 1 << bitSet; bitSet = 1 << bitSet;
QVariant typedBitSet;
switch (fact->type()) {
case FactMetaData::valueTypeInt8:
typedBitSet = QVariant((signed char)bitSet);
break;
case FactMetaData::valueTypeInt16:
typedBitSet = QVariant((short int)bitSet);
break;
case FactMetaData::valueTypeInt32:
typedBitSet = QVariant((int)bitSet);
break;
case FactMetaData::valueTypeUint8:
case FactMetaData::valueTypeUint16:
case FactMetaData::valueTypeUint32:
typedBitSet = QVariant(bitSet);
break;
default:
break;
}
if (typedBitSet.isNull()) {
qCDebug(APMParameterMetaDataLog) << "Invalid type for bitmask, name:" << metaData->name()
<< " type:" << metaData->type();
}
if (!ok) { if (!ok) {
qCDebug(APMParameterMetaDataLog) << "Invalid bitmask value, name:" << metaData->name() qCDebug(APMParameterMetaDataLog) << "Invalid bitmask value, name:" << metaData->name()
<< " type:" << metaData->type() << " value:" << bitmaskPair.first << " type:" << metaData->type() << " value:" << bitSet
<< " error:" << errorString; << " error: toUInt failed";
bitmaskStrings.clear(); bitmaskStrings.clear();
bitmaskValues.clear(); bitmaskValues.clear();
break; break;
} }
if (metaData->convertAndValidateRaw(bitSet, false /* validate */, bitmaskValue, errorString)) { if (metaData->convertAndValidateRaw(typedBitSet, false /* validate */, bitmaskValue, errorString)) {
bitmaskValues << bitmaskValue; bitmaskValues << bitmaskValue;
bitmaskStrings << bitmaskPair.second; bitmaskStrings << bitmaskPair.second;
} else { } else {
qCDebug(APMParameterMetaDataLog) << "Invalid bitmask value, name:" << metaData->name() qCDebug(APMParameterMetaDataLog) << "Invalid bitmask value, name:" << metaData->name()
<< " type:" << metaData->type() << " value:" << bitmaskPair.first << " type:" << metaData->type() << " value:" << typedBitSet
<< " error:" << errorString; << " error:" << errorString;
bitmaskStrings.clear(); bitmaskStrings.clear();
bitmaskValues.clear(); bitmaskValues.clear();
......
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