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

Fix loading from parameter cache (#9134)

parent c077b69e
......@@ -832,11 +832,13 @@ void ParameterManager::_tryCacheHashLoad(int vehicleId, int componentId, QVarian
/* compute the crc of the local cache to check against the remote */
for (const QString& name: cacheMap.keys()) {
if (_vehicle->compInfoManager()->compInfoParam(MAV_COMP_ID_AUTOPILOT1)->_isParameterVolatile(name)) {
const ParamTypeVal& paramTypeVal = cacheMap[name];
const FactMetaData::ValueType_t fact_type = static_cast<FactMetaData::ValueType_t>(paramTypeVal.first);
if (_vehicle->compInfoManager()->compInfoParam(MAV_COMP_ID_AUTOPILOT1)->factMetaDataForName(name, fact_type)->volatileValue()) {
// Does not take part in CRC
qCDebug(ParameterManagerLog) << "Volatile parameter" << name;
} else {
const ParamTypeVal& paramTypeVal = cacheMap[name];
const void *vdat = paramTypeVal.second.constData();
const FactMetaData::ValueType_t fact_type = static_cast<FactMetaData::ValueType_t>(paramTypeVal.first);
crc32_value = QGC::crc32((const uint8_t *)qPrintable(name), name.length(), crc32_value);
......
......@@ -229,11 +229,6 @@ public:
/// Important: Only CompInfoParam code should use this method
virtual FactMetaData* _getMetaDataForFact(QObject* /*parameterMetaData*/, const QString& /*name*/, FactMetaData::ValueType_t /* type */, MAV_TYPE /*vehicleType*/) { return nullptr; }
/// Returns the FactMetaData associated with the parameter name
/// @param opaqueParameterMetaData Opaque pointer returned from loadParameterMetaData
/// Important: Only CompInfoParam code should use this method
virtual bool _isParameterVolatile(QObject* /*parameterMetaData*/, const QString& /*name*/, MAV_TYPE /*vehicleType*/) { return false; }
/// List of supported mission commands. Empty list for all commands supported.
virtual QList<MAV_CMD> supportedMissionCommands(QGCMAVLink::VehicleClass_t vehicleClass);
......
......@@ -142,18 +142,6 @@ FactMetaData* CompInfoParam::factMetaDataForName(const QString& name, FactMetaDa
return factMetaData;
}
bool CompInfoParam::_isParameterVolatile(const QString& name)
{
if (_noJsonMetadata) {
QObject* opaqueMetaData = _getOpaqueParameterMetaData();
if (opaqueMetaData) {
return vehicle->firmwarePlugin()->_isParameterVolatile(opaqueMetaData, name, vehicle->vehicleType());
}
}
return _nameToMetaDataMap.contains(name) ? _nameToMetaDataMap[name]->volatileValue() : false;
}
FirmwarePlugin* CompInfoParam::_anyVehicleTypeFirmwarePlugin(MAV_AUTOPILOT firmwareType)
{
FirmwarePluginManager* pluginMgr = qgcApp()->toolbox()->firmwarePluginManager();
......
......@@ -34,9 +34,6 @@ public:
// Overrides from CompInfo
void setJson(const QString& metadataJsonFileName, const QString& translationJsonFileName) override;
// The following methods are used to support the old non-COMPONENT_INFORMATION based mechanism to get parameter meta data
bool _isParameterVolatile (const QString& name);
static void _cachePX4MetaDataFile(const QString& metaDataFile);
private:
......
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