Commit ce55805c authored by Don Gagne's avatar Don Gagne

Merge pull request #897 from anton-matosov/master

Fixed crashing at connection time if pixhawk MAV_COMP_ID is not set to default (50)
parents 33e3c7de 728b350e
......@@ -163,32 +163,33 @@ void PX4RCCalibration::_setInternalCalibrationValuesFromParameters(void)
QVariant value;
bool paramFound;
bool convertOk;
int componentId = _paramMgr->getDefaultComponentId();
for (int i = 0; i < _chanMax; ++i) {
struct ChannelInfo* info = &_rgChannelInfo[i];
paramFound = _paramMgr->getParameterValue(50, trimTpl.arg(i+1), value);
paramFound = _paramMgr->getParameterValue(componentId, trimTpl.arg(i+1), value);
Q_ASSERT(paramFound);
if (paramFound) {
info->rcTrim = value.toInt(&convertOk);
Q_ASSERT(convertOk);
}
paramFound = _paramMgr->getParameterValue(50, minTpl.arg(i+1), value);
paramFound = _paramMgr->getParameterValue(componentId, minTpl.arg(i+1), value);
Q_ASSERT(paramFound);
if (paramFound) {
info->rcMin = value.toInt(&convertOk);
Q_ASSERT(convertOk);
}
paramFound = _paramMgr->getParameterValue(50, maxTpl.arg(i+1), value);
paramFound = _paramMgr->getParameterValue(componentId, maxTpl.arg(i+1), value);
Q_ASSERT(paramFound);
if (paramFound) {
info->rcMax = value.toInt(&convertOk);
Q_ASSERT(convertOk);
}
paramFound = _paramMgr->getParameterValue(50, revTpl.arg(i+1), value);
paramFound = _paramMgr->getParameterValue(componentId, revTpl.arg(i+1), value);
Q_ASSERT(paramFound);
if (paramFound) {
float floatReversed = value.toFloat(&convertOk);
......@@ -201,7 +202,7 @@ void PX4RCCalibration::_setInternalCalibrationValuesFromParameters(void)
for (int i=0; i<rcCalFunctionMax; i++) {
int32_t paramChannel;
paramFound = _paramMgr->getParameterValue(50, _rgFunctionInfo[i].parameterName, value);
paramFound = _paramMgr->getParameterValue(componentId, _rgFunctionInfo[i].parameterName, value);
Q_ASSERT(paramFound);
if (paramFound) {
paramChannel = value.toInt(&convertOk);
......
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