Unverified Commit d8e031de authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6027 from DonLakeFlyer/ParamMeta

Parameter metadata fixes
parents 67b428fb 83079a42
...@@ -314,7 +314,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO ...@@ -314,7 +314,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
typedValue = QVariant(rawValue.toInt(&convertOk)); typedValue = QVariant(rawValue.toInt(&convertOk));
if (!convertOnly && convertOk) { if (!convertOnly && convertOk) {
if (typedValue < rawMin() || typedValue > rawMax()) { if (typedValue < rawMin() || typedValue > rawMax()) {
errorString = tr("Value must be within %1 and %2").arg(cookedMin().toInt()).arg(cookedMax().toInt()); errorString = tr("Value must be within %1 and %2").arg(rawMin().toInt()).arg(rawMax().toInt());
} }
} }
break; break;
...@@ -324,7 +324,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO ...@@ -324,7 +324,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
typedValue = QVariant(rawValue.toUInt(&convertOk)); typedValue = QVariant(rawValue.toUInt(&convertOk));
if (!convertOnly && convertOk) { if (!convertOnly && convertOk) {
if (typedValue < rawMin() || typedValue > rawMax()) { if (typedValue < rawMin() || typedValue > rawMax()) {
errorString = tr("Value must be within %1 and %2").arg(cookedMin().toUInt()).arg(cookedMax().toUInt()); errorString = tr("Value must be within %1 and %2").arg(rawMin().toUInt()).arg(rawMax().toUInt());
} }
} }
break; break;
...@@ -332,7 +332,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO ...@@ -332,7 +332,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
typedValue = QVariant(rawValue.toFloat(&convertOk)); typedValue = QVariant(rawValue.toFloat(&convertOk));
if (!convertOnly && convertOk) { if (!convertOnly && convertOk) {
if (typedValue < rawMin() || typedValue > rawMax()) { if (typedValue < rawMin() || typedValue > rawMax()) {
errorString = tr("Value must be within %1 and %2").arg(cookedMin().toFloat()).arg(cookedMax().toFloat()); errorString = tr("Value must be within %1 and %2").arg(rawMin().toFloat()).arg(rawMax().toFloat());
} }
} }
break; break;
...@@ -341,7 +341,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO ...@@ -341,7 +341,7 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
typedValue = QVariant(rawValue.toDouble(&convertOk)); typedValue = QVariant(rawValue.toDouble(&convertOk));
if (!convertOnly && convertOk) { if (!convertOnly && convertOk) {
if (typedValue < rawMin() || typedValue > rawMax()) { if (typedValue < rawMin() || typedValue > rawMax()) {
errorString = tr("Value must be within %1 and %2").arg(cookedMin().toDouble()).arg(cookedMax().toDouble()); errorString = tr("Value must be within %1 and %2").arg(rawMin().toDouble()).arg(rawMax().toDouble());
} }
} }
break; break;
......
...@@ -3312,7 +3312,7 @@ by initializing the estimator to the LPE_LAT/LON parameters when global informat ...@@ -3312,7 +3312,7 @@ by initializing the estimator to the LPE_LAT/LON parameters when global informat
<short_desc>Integer bitmask controlling data fusion</short_desc> <short_desc>Integer bitmask controlling data fusion</short_desc>
<long_desc>Set bits in the following positions to enable: 0 : Set to true to fuse GPS data if available, also requires GPS for altitude init 1 : Set to true to fuse optical flow data if available 2 : Set to true to fuse vision position 3 : Set to true to enable landing target 4 : Set to true to fuse land detector 5 : Set to true to publish AGL as local position down component 6 : Set to true to enable flow gyro compensation 7 : Set to true to enable baro fusion default (145 - GPS, baro, land detector)</long_desc> <long_desc>Set bits in the following positions to enable: 0 : Set to true to fuse GPS data if available, also requires GPS for altitude init 1 : Set to true to fuse optical flow data if available 2 : Set to true to fuse vision position 3 : Set to true to enable landing target 4 : Set to true to fuse land detector 5 : Set to true to publish AGL as local position down component 6 : Set to true to enable flow gyro compensation 7 : Set to true to enable baro fusion default (145 - GPS, baro, land detector)</long_desc>
<min>0</min> <min>0</min>
<max>4294967295</max> <max>255</max>
<scope>modules/local_position_estimator</scope> <scope>modules/local_position_estimator</scope>
<bitmask> <bitmask>
<bit index="0"> fuse GPS, requires GPS for alt. init</bit> <bit index="0"> fuse GPS, requires GPS for alt. init</bit>
......
...@@ -265,7 +265,7 @@ void PX4ParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData ...@@ -265,7 +265,7 @@ void PX4ParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData
qCDebug(PX4ParameterMetaDataLog) << "Min:" << text; qCDebug(PX4ParameterMetaDataLog) << "Min:" << text;
QVariant varMin; QVariant varMin;
if (metaData->convertAndValidateRaw(text, true /* convertOnly */, varMin, errorString)) { if (metaData->convertAndValidateRaw(text, false /* convertOnly */, varMin, errorString)) {
metaData->setRawMin(varMin); metaData->setRawMin(varMin);
} else { } else {
qCWarning(PX4ParameterMetaDataLog) << "Invalid min value, name:" << metaData->name() << " type:" << metaData->type() << " min:" << text << " error:" << errorString; qCWarning(PX4ParameterMetaDataLog) << "Invalid min value, name:" << metaData->name() << " type:" << metaData->type() << " min:" << text << " error:" << errorString;
...@@ -276,7 +276,7 @@ void PX4ParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData ...@@ -276,7 +276,7 @@ void PX4ParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData
qCDebug(PX4ParameterMetaDataLog) << "Max:" << text; qCDebug(PX4ParameterMetaDataLog) << "Max:" << text;
QVariant varMax; QVariant varMax;
if (metaData->convertAndValidateRaw(text, true /* convertOnly */, varMax, errorString)) { if (metaData->convertAndValidateRaw(text, false /* convertOnly */, varMax, errorString)) {
metaData->setRawMax(varMax); metaData->setRawMax(varMax);
} else { } else {
qCWarning(PX4ParameterMetaDataLog) << "Invalid max value, name:" << metaData->name() << " type:" << metaData->type() << " max:" << text << " error:" << errorString; qCWarning(PX4ParameterMetaDataLog) << "Invalid max value, name:" << metaData->name() << " type:" << metaData->type() << " max:" << text << " error:" << errorString;
......
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