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

Merge pull request #8047 from DonLakeFlyer/NoMetdata

ArduPilot: Group parameters with no metadata correctly
parents 3eec1ca0 4eb9fb49
......@@ -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
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)
// 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;
......
......@@ -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>
......
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