Hi developers,
I want a modification in the QGC, especially for adding TextFields to get and set WP_RADIUS and LOIT_RADIUS parameters directly in PlanView.qml.
However, I have stucked for a few days. When, I get a Fact related to the parameter name in PlanView.qml, the value is always zero and I cannot set the parameter’s value.
Here is the code that I have added.
I defined the controller like this in the PlanView.qml:
ParameterEditorController {
id: controller;
}
And I did a testing to get and set AHRS_TRIM_Y parameter in a TextField inside PlanView.qml like this:
TextField{
id: atextfield
......
onEditingFinished: {
var fact = controller.parameters.get(1)
console.log(fact)
console.log(fact.name)
console.log(fact.value)
fact.value = "5"
fact.valueChanged(fact.value)
}
}
When I edit the TextField, the output in the console is false. The value is zero. It should be 5 as in APM:
qml: Fact(<a hex number>)
qml: AHRS_TRIM_Y
qml: 0
But, when I did the same testing in ParameterEditor.qml, the output is true (equal to value in APM):
qml: Fact(<a hex number>)
qml: AHRS_TRIM_Y
qml: 5
What makes this different?
Is it possible to get and set the parameters outside the ParameterEditor.qml?
Is there any technique that should be used to do this?
I am so sorry if this is a dummy question.
I would appreciate any help in this matter.