Browse Source

Group parameters with no metadata with the other existing params in the group, not in "Other"

QGC4.4
DonLakeFlyer 6 years ago
parent
commit
4eb9fb49f1
  1. 12
      src/FirmwarePlugin/APM/APMParameterMetaData.cc
  2. 1
      src/FirmwarePlugin/APM/APMParameterMetaData.h

12
src/FirmwarePlugin/APM/APMParameterMetaData.cc

@ -129,6 +129,13 @@ QString APMParameterMetaData::mavTypeToString(MAV_TYPE vehicleTypeEnum) @@ -129,6 +129,13 @@ QString APMParameterMetaData::mavTypeToString(MAV_TYPE vehicleTypeEnum)
return vehicleName;
}
QString APMParameterMetaData::_groupFromParameterName(const QString& name)
{
QString group = name.split('_').first();
return group.remove(QRegExp("[0-9]*$")); // remove any numbers from the end
}
void APMParameterMetaData::loadParameterFactMetaDataFile(const QString& metaDataFile)
{
if (_parameterMetaDataLoaded) {
@ -232,8 +239,7 @@ void APMParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData @@ -232,8 +239,7 @@ void APMParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData
if (name.contains(':')) {
name = name.split(':').last();
}
QString group = name.split('_').first();
group = group.remove(QRegExp("[0-9]*$")); // remove any numbers from the end
QString group = _groupFromParameterName(name);
QString category = xml.attributes().value("user").toString();
if (category.isEmpty()) {
@ -435,6 +441,8 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType) @@ -435,6 +441,8 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
// we don't have data for this fact
if (!rawMetaData) {
metaData->setCategory(QStringLiteral("Advanced"));
metaData->setGroup(_groupFromParameterName(fact->name()));
fact->setMetaData(metaData);
qCDebug(APMParameterMetaDataLog) << "No metaData for " << fact->name() << "using generic metadata";
return;

1
src/FirmwarePlugin/APM/APMParameterMetaData.h

@ -80,6 +80,7 @@ private: @@ -80,6 +80,7 @@ private:
bool parseParameterAttributes(QXmlStreamReader& xml, APMFactMetaDataRaw *rawMetaData);
void correctGroupMemberships(ParameterNametoFactMetaDataMap& parameterToFactMetaDataMap, QMap<QString,QStringList>& groupMembers);
QString mavTypeToString(MAV_TYPE vehicleTypeEnum);
QString _groupFromParameterName(const QString& name);
bool _parameterMetaDataLoaded; ///< true: parameter meta data already loaded
QMap<QString, ParameterNametoFactMetaDataMap> _vehicleTypeToParametersMap; ///< Maps from a vehicle type to paramametertoFactMeta map>

Loading…
Cancel
Save