Commit a7779df7 authored by DonLakeFlyer's avatar DonLakeFlyer

Adjust to new parameters in Copter 3.6

Includes support for battery 2 setup
parent 77b6dc5e
......@@ -18,32 +18,32 @@ FactPanel {
factPanel: panel
}
property bool _useOldFrameParam: controller.parameterExists(-1, "FRAME")
property Fact _oldFrameParam: controller.getParameterFact(-1, "FRAME", false)
property Fact _newFrameParam: controller.getParameterFact(-1, "FRAME_CLASS", false)
property Fact _frameTypeParam: controller.getParameterFact(-1, "FRAME_TYPE", false)
property bool _frameAvailable: controller.parameterExists(-1, "FRAME")
property Fact _frame: controller.getParameterFact(-1, "FRAME", false)
property Fact _frameClass: controller.getParameterFact(-1, "FRAME_CLASS", false)
property Fact _frameType: controller.getParameterFact(-1, "FRAME_TYPE", false)
Column {
anchors.fill: parent
VehicleSummaryRow {
labelText: qsTr("Frame Type")
valueText: controller.currentAirframeTypeName() + " " + _oldFrameParam.enumStringValue
visible: _useOldFrameParam
valueText: visible ? controller.currentAirframeTypeName() + " " + _frame.enumStringValue : ""
visible: _frameAvailable
}
VehicleSummaryRow {
labelText: qsTr("Frame Class")
valueText: _newFrameParam.enumStringValue
visible: !_useOldFrameParam
valueText: visible ? _frameClass.enumStringValue : ""
visible: !_frameAvailable
}
VehicleSummaryRow {
labelText: qsTr("Frame Type")
valueText: _frameTypeParam.enumStringValue
visible: !_useOldFrameParam
valueText: visible ? _frameType.enumStringValue : ""
visible: !_frameAvailable
}
VehicleSummaryRow {
......
......@@ -31,46 +31,119 @@ SetupPage {
Component {
id: powerPageComponent
Column {
spacing: _margins
Flow {
id: flowLayout
width: availableWidth
spacing: _margins
property bool _batt2ParamsAvailable: controller.parameterExists(-1, "BATT2_FS_LOW_ACT")
property bool _batt2MonitorAvailable: controller.parameterExists(-1, "BATT2_MONITOR")
property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
QGCLabel { text: qsTr("Battery 1"); font.pointSize: ScreenTools.mediumFontPointSize }
QGCPalette { id: ggcPal; colorGroupEnabled: true }
Loader {
sourceComponent: powerSetupComponent
// Battery 1 settings
Column {
spacing: _margins / 2
QGCLabel {
text: qsTr("Battery 1")
font.family: ScreenTools.demiboldFontFamily
}
property Fact armVoltMin: controller.getParameterFact(-1, "r.ARMING_VOLT_MIN")
property Fact battAmpPerVolt: controller.getParameterFact(-1, "BATT_AMP_PERVOLT")
property Fact battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY")
property Fact battCurrPin: controller.getParameterFact(-1, "BATT_CURR_PIN")
property Fact battMonitor: controller.getParameterFact(-1, "BATT_MONITOR")
property Fact battVoltMult: controller.getParameterFact(-1, "BATT_VOLT_MULT")
property Fact battVoltPin: controller.getParameterFact(-1, "BATT_VOLT_PIN")
property Fact vehicleVoltage: controller.vehicle.battery.voltage
property Fact vehicleCurrent: controller.vehicle.battery.current
Rectangle {
width: battery1Loader.x + battery1Loader.width + _margins
height: battery1Loader.y + battery1Loader.height + _margins
color: ggcPal.windowShade
Loader {
id: battery1Loader
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
sourceComponent: powerSetupComponent
property Fact armVoltMin: controller.getParameterFact(-1, "r.ARMING_VOLT_MIN")
property Fact battAmpPerVolt: controller.getParameterFact(-1, "r.BATT_AMP_PERVLT")
property Fact battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY")
property Fact battCurrPin: controller.getParameterFact(-1, "BATT_CURR_PIN")
property Fact battMonitor: controller.getParameterFact(-1, "BATT_MONITOR")
property Fact battVoltMult: controller.getParameterFact(-1, "BATT_VOLT_MULT")
property Fact battVoltPin: controller.getParameterFact(-1, "BATT_VOLT_PIN")
property Fact vehicleVoltage: controller.vehicle.battery.voltage
property Fact vehicleCurrent: controller.vehicle.battery.current
}
}
}
Item {
height: ScreenTools.defaultFontPixelHeight
width: 1
// Batter2 Monitor settings only - used when only monitor param is available
Column {
spacing: _margins / 2
visible: _batt2MonitorAvailable && !_batt2ParamsAvailable
QGCLabel {
text: qsTr("Battery 2")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
width: batt2MonitorRow.x + batt2MonitorRow.width + _margins
height: batt2MonitorRow.y + batt2MonitorRow.height + _margins
color: ggcPal.windowShade
RowLayout {
id: batt2MonitorRow
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
spacing: ScreenTools.defaultFontPixelWidth
visible: _batt2MonitorAvailable && !_batt2ParamsAvailable
QGCLabel { text: qsTr("Battery2 monitor:") }
FactComboBox {
id: monitorCombo
fact: _batt2Monitor
indexModel: false
}
}
}
}
QGCLabel { text: qsTr("Battery 2"); font.pointSize: ScreenTools.mediumFontPointSize }
// Battery 2 settings - Used when full params are available
Column {
spacing: _margins / 2
visible: _batt2ParamsAvailable
Loader {
sourceComponent: powerSetupComponent
QGCLabel {
text: qsTr("Battery 2")
font.family: ScreenTools.demiboldFontFamily
}
property Fact armVoltMin: controller.getParameterFact(-1, "r.ARMING_VOLT2_MIN")
property Fact battAmpPerVolt: controller.getParameterFact(-1, "BATT2_AMP_PERVOL")
property Fact battCapacity: controller.getParameterFact(-1, "BATT2_CAPACITY")
property Fact battCurrPin: controller.getParameterFact(-1, "BATT2_CURR_PIN")
property Fact battMonitor: controller.getParameterFact(-1, "BATT2_MONITOR")
property Fact battVoltMult: controller.getParameterFact(-1, "BATT2_VOLT_MULT")
property Fact battVoltPin: controller.getParameterFact(-1, "BATT2_VOLT_PIN")
property Fact vehicleVoltage: controller.vehicle.battery2.voltage
property Fact vehicleCurrent: controller.vehicle.battery2.current
Rectangle {
width: battery2Loader.x + battery2Loader.width + _margins
height: battery2Loader.y + battery2Loader.height + _margins
color: ggcPal.windowShade
Loader {
id: battery2Loader
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
sourceComponent: _batt2ParamsAvailable ? powerSetupComponent : undefined
property Fact armVoltMin: controller.getParameterFact(-1, "r.ARMING_VOLT2_MIN", false /* reportMissing */)
property Fact battAmpPerVolt: controller.getParameterFact(-1, "r.BATT2_AMP_PERVLT", false /* reportMissing */)
property Fact battCapacity: controller.getParameterFact(-1, "BATT2_CAPACITY", false /* reportMissing */)
property Fact battCurrPin: controller.getParameterFact(-1, "BATT2_CURR_PIN", false /* reportMissing */)
property Fact battMonitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
property Fact battVoltMult: controller.getParameterFact(-1, "BATT2_VOLT_MULT", false /* reportMissing */)
property Fact battVoltPin: controller.getParameterFact(-1, "BATT2_VOLT_PIN", false /* reportMissing */)
property Fact vehicleVoltage: controller.vehicle.battery2.voltage
property Fact vehicleCurrent: controller.vehicle.battery2.current
}
}
}
}
} // Flow
} // Component - powerPageComponent
Component {
......
......@@ -24,20 +24,37 @@ FactPanel {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY")
property Fact battMonitor: controller.getParameterFact(-1, "BATT_MONITOR")
property bool _batt2MonitorAvailable: controller.parameterExists(-1, "BATT2_MONITOR")
property bool _batt2CapacityAvailable: controller.parameterExists(-1, "BATT2_CAPACITY")
property Fact _battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY")
property Fact _batt2Capacity: controller.getParameterFact(-1, "BATT2_CAPACITY", false /* reportMissing */)
property Fact _battMonitor: controller.getParameterFact(-1, "BATT_MONITOR")
property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
Column {
anchors.fill: parent
VehicleSummaryRow {
labelText: qsTr("Battery monitor")
valueText: battMonitor.enumStringValue
valueText: _battMonitor.enumStringValue
}
VehicleSummaryRow {
labelText: qsTr("Battery capacity")
valueText: battCapacity.valueString + " " + battCapacity.units
valueText: _battCapacity.valueString + " " + _battCapacity.units
}
VehicleSummaryRow {
labelText: qsTr("Battery2 monitor")
valueText: _batt2MonitorAvailable ? _batt2Monitor.enumStringValue : ""
visible: _batt2MonitorAvailable
}
VehicleSummaryRow {
labelText: qsTr("Battery2 capacity")
valueText: _batt2CapacityAvailable ? _batt2Capacity.valueString + " " + _battCapacity.units : ""
visible: _batt2CapacityAvailable
}
}
}
......@@ -34,8 +34,8 @@ SetupPage {
QGCPalette { id: palette; colorGroupEnabled: true }
property Fact _failsafeBattMah: controller.getParameterFact(-1, "FS_BATT_MAH")
property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE")
property Fact _failsafeBattMah: controller.getParameterFact(-1, "r.BATT_LOW_MAH")
property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "r.BATT_LOW_VOLT")
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "THR_FAILSAFE")
property Fact _failsafeThrValue: controller.getParameterFact(-1, "THR_FS_VALUE")
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABL")
......
......@@ -14,7 +14,7 @@ FactPanel {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property Fact _failsafeBattEnable: controller.getParameterFact(-1, "FS_BATT_ENABLE")
property Fact _failsafeBattLowAct: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT")
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE")
property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION")
......@@ -28,60 +28,14 @@ FactPanel {
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")
property string _failsafeBattEnableText
property string _failsafeThrEnableText
property bool _failsafeBattCritActAvailable: controller.parameterExists(-1, "BATT_FS_CRT_ACT")
property bool _failsafeBatt2LowActAvailable: controller.parameterExists(-1, "BATT2_FS_LOW_ACT")
property bool _failsafeBatt2CritActAvailable: controller.parameterExists(-1, "BATT2_FS_CRT_ACT")
Component.onCompleted: {
setFailsafeBattEnableText()
setFailsafeThrEnableText()
}
Connections {
target: _failsafeBattEnable
onValueChanged: setFailsafeBattEnableText()
}
Connections {
target: _failsafeThrEnable
onValueChanged: setFailsafeThrEnableText()
}
function setFailsafeThrEnableText() {
switch (_failsafeThrEnable.value) {
case 0:
_failsafeThrEnableText = qsTr("Disabled")
break
case 1:
_failsafeThrEnableText = qsTr("Always RTL")
break
case 2:
_failsafeThrEnableText = qsTr("Continue with Mission in Auto Mode")
break
case 3:
_failsafeThrEnableText = qsTr("Always Land")
break
default:
_failsafeThrEnableText = qsTr("Unknown")
}
}
function setFailsafeBattEnableText() {
switch (_failsafeBattEnable.value) {
case 0:
_failsafeBattEnableText = qsTr("Disabled")
break
case 1:
_failsafeBattEnableText = qsTr("Land")
break
case 2:
_failsafeBattEnableText = qsTr("Return to Launch")
break
default:
_failsafeThrEnableText = qsTr("Unknown")
}
}
property Fact _failsafeBattCritAct: controller.getParameterFact(-1, "BATT_FS_CRT_ACT", false /* reportMissing */)
property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
property Fact _failsafeBatt2LowAct: controller.getParameterFact(-1, "BATT2_FS_LOW_ACT", false /* reportMissing */)
property Fact _failsafeBatt2CritAct: controller.getParameterFact(-1, "BATT2_FS_CRT_ACT", false /* reportMissing */)
Column {
anchors.fill: parent
......@@ -93,12 +47,30 @@ FactPanel {
VehicleSummaryRow {
labelText: qsTr("Throttle failsafe:")
valueText: _failsafeThrEnableText
valueText: _failsafeBattLowAct.enumStringValue
}
VehicleSummaryRow {
labelText: qsTr("Batt low failsafe:")
valueText: _failsafeBattLowAct.enumStringValue
}
VehicleSummaryRow {
labelText: qsTr("Batt critical failsafe:")
valueText: _failsafeBattCritActAvailable ? _failsafeBattCritAct.enumStringValue : ""
visible: _failsafeBattCritActAvailable
}
VehicleSummaryRow {
labelText: qsTr("Batt2 low failsafe:")
valueText: _failsafeBatt2LowActAvailable ? _failsafeBatt2LowAct.enumStringValue : ""
visible: _failsafeBatt2LowActAvailable
}
VehicleSummaryRow {
labelText: qsTr("Battery failsafe:")
valueText: _failsafeBattEnableText
labelText: qsTr("Batt2 critical failsafe:")
valueText: _failsafeBatt2CritActAvailable ? _failsafeBatt2CritAct.enumStringValue : ""
visible: _failsafeBatt2CritActAvailable
}
VehicleSummaryRow {
......
......@@ -88,6 +88,8 @@ void FactPanelController::_reportMissingParameter(int componentId, const QString
QString missingParam = QString("%1:%2").arg(componentId).arg(name);
qCWarning(FactPanelControllerLog) << "Missing parameter:" << missingParam;
// If missing parameters a reported from the constructor of a derived class we
// will not have access to _factPanel yet. Just record list of missing facts
// in that case instead of notify. Once _factPanel is available they will be
......
......@@ -791,6 +791,8 @@ QString APMFirmwarePlugin::internalParameterMetaDataFile(Vehicle* vehicle)
return QStringLiteral(":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.4.xml");
case 5:
return QStringLiteral(":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.5.xml");
case 6:
return QStringLiteral(":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.6.xml");
default:
if (minorVersion < 3) {
return QStringLiteral(":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.3.xml");
......
This diff is collapsed.
......@@ -47,6 +47,7 @@
<file alias="APMParameterFactMetaData.Copter.3.3.xml">APMParameterFactMetaData.Copter.3.3.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.4.xml">APMParameterFactMetaData.Copter.3.4.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.5.xml">APMParameterFactMetaData.Copter.3.5.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.6.xml">APMParameterFactMetaData.Copter.3.6.xml</file>
<file alias="APMParameterFactMetaData.Rover.3.0.xml">APMParameterFactMetaData.Rover.3.0.xml</file>
<file alias="APMParameterFactMetaData.Rover.3.2.xml">APMParameterFactMetaData.Rover.3.2.xml</file>
<file alias="APMParameterFactMetaData.Sub.3.4.xml">APMParameterFactMetaData.Sub.3.4.xml</file>
......
......@@ -148,6 +148,14 @@ ArduCopterFirmwarePlugin::ArduCopterFirmwarePlugin(void)
remapV3_5["ARMING_VOLT_MIN"] = QStringLiteral("ARMING_MIN_VOLT");
remapV3_5["ARMING_VOLT2_MIN"] = QStringLiteral("ARMING_MIN_VOLT2");
FirmwarePlugin::remapParamNameMap_t& remapV3_6 = _remapParamName[3][6];
remapV3_6["BATT_AMP_PERVLT"] = QStringLiteral("BATT_AMP_PERVOL");
remapV3_6["BATT2_AMP_PERVLT"] = QStringLiteral("BATT2_AMP_PERVOL");
remapV3_6["BATT_LOW_MAH"] = QStringLiteral("FS_BATT_MAH");
remapV3_6["BATT_LOW_VOLT"] = QStringLiteral("FS_BATT_VOLTAGE");
remapV3_6["BATT_FS_LOW_ACT"] = QStringLiteral("FS_BATT_ENABLE");
_remapParamNameIntialized = true;
}
}
......
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