I have a new firmware on my drone that defines some new parameters. I’ve added the definition to the PX4ParameterFactMetaData.xml file and made sure it passes xmllint (minus dtd info). When debugging is enabled I see that the definitions are loaded, but when trying to access the parameters (using for example FactTextField), there are no units defined in the text field, and when I try to modify the values (in this case in the SafetyComponent page) it hangs the page. It saves the value to the remote device, but I can’t leave the page. Any help?
(as an aside… I did the same thing using an old QGC4 build tree, and it worked)
Relevant code:
{this is in the SafetyComponent.qml}
…
property Fact _myNewVariable1: controller.getParameterFact(-1, "MY_NEW_VAR_1", false)
...
QGCLabel {
text: qsTr("These Are My New Variables")
}
Rectangle {
width: mainRow.width + (_margins * 2)
height: myVariableGrid.height + (_margins * 2)
color: qgcPal.windowShade
Row {
id: myVariableGrid
spacing: _margins
anchors.centerIn: parent
Item {
width: _imageWidth
height: _imageHeight
anchors.verticalCenter: parent.verticalCenter
Image {
mipmap: true
fillMode: Image.PreserveAspectFit
source: /qmlimages/myvariableImage.svg"
height: _imageHeight
anchors.centerIn: parent
}
}
GridLayout {
columns: 2
anchors.verticalCenter: parent.verticalCenter
QGCLabel {
text: qsTr("My First New Variable")
enabled: controller.vehicle
Layout.fillWidth: true
}
QGCComboBox {
model: [qsTr("Disabled"), qsTr("Enabled")]
enabled: _myNewVariable1
Layout.minimumWidth:_editFieldWidth
Layout.fillWidth: true
currentIndex: _myNewVariable1 ?(_myNewVariable1.value === 0 ? 0 : 1) : 0
onActivated: (index) => {
if(_myNewVariable1) {
_myNewVariable1.value = index > 0 ? 1 : 0
}
}
}
QGCLabel {
text: qsTr("Edit Variable 2")
enabled: _myNewVariable1 ? _myNewVariable1.value : false
Layout.fillWidth: true
}
FactTextField {
fact: controller.getParameterFact(-1, "MY_NEW_VAR_2")
Layout.fillWidth: true
enabled: _myNewVariable1 ? _myNewVariable1.value : false
}
QGCLabel {
text: qsTr("Edit Variable 3")
enabled: _myNewVariable1 ? _myNewVariable1.value : false
Layout.fillWidth: true
}
FactTextField {
fact: controller.getParameterFact(-1, "MY_NEW_VAR_3")
enabled: _myNewVariable1 ? _myNewVariable1.value : false
Layout.fillWidth: true
}
}
}
}
and the relevant XML changes are in PX4ParameterFactMetaData.xml
<group name="My 3 New Variables">
<parameter name="MY_NEW_VAR_1" default="0" type="INT32">
<short_desc>Enable Variable 1</short_desc>
<long_desc>Enable Variable 1</long_desc>
<min>0</min>
<max>1</max>
<values>
<value code="0">Disabled</value>
<value code="1">Enabled</value>
</values>
</parameter>
<parameter name="MY_NEW_VAR_2" default="0" type="FLOAT">
<short_desc>Modify Variable 2</short_desc>
<long_desc>Modify Variable 2</long_desc>
<min>0</min>
<max>360</max>
<unit>deg</unit>
</parameter>
<parameter name="MY_NEW_VAR_3" default="0.0" type="FLOAT">
<short_desc>Edit Variable 3</short_desc>
<long_desc>Edit Variable 3</long_desc>
<min>0</min>
<unit>m</unit>
</parameter>
</group>