1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-1592 New filtering method as requested in review

This commit is contained in:
Laurent Lalanne 2014-11-02 14:42:08 +01:00
parent 49869d9598
commit 8cc95451a5
2 changed files with 19 additions and 10 deletions

View File

@ -98,6 +98,22 @@ bool VehicleConfigurationHelper::setupHardwareSettings(bool save)
return result; return result;
} }
bool VehicleConfigurationHelper::isApplicable(UAVObject *object)
{
switch (m_configSource->getControllerType()) {
case VehicleConfigurationSource::CONTROLLER_CC:
case VehicleConfigurationSource::CONTROLLER_CC3D:
if (object->getName() == "EKFConfiguration") {
return false;
} else {
return true;
}
break;
default:
return true;
}
}
void VehicleConfigurationHelper::addModifiedObject(UAVDataObject *object, QString description) void VehicleConfigurationHelper::addModifiedObject(UAVDataObject *object, QString description)
{ {
m_modifiedObjects << new QPair<UAVDataObject *, QString>(object, description); m_modifiedObjects << new QPair<UAVDataObject *, QString>(object, description);
@ -752,16 +768,8 @@ void VehicleConfigurationHelper::applyTemplateSettings()
foreach(UAVObject * object, updatedObjects) { foreach(UAVObject * object, updatedObjects) {
UAVDataObject *dataObj = dynamic_cast<UAVDataObject *>(object); UAVDataObject *dataObj = dynamic_cast<UAVDataObject *>(object);
// Do not apply EKFConfiguration for CC and CC3D boards if (dataObj != NULL && isApplicable(object)) {
if (dataObj != NULL) { addModifiedObject(dataObj, tr("Writing template settings for %1").arg(object->getName()));
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC ||
m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC3D) {
if (object->getName() != "EKFConfiguration") {
addModifiedObject(dataObj, QString(tr("Writing template settings for %1")).arg(object->getName()));
}
} else {
addModifiedObject(dataObj, QString(tr("Writing template settings for %1")).arg(object->getName()));
}
} }
} }
} }

View File

@ -57,6 +57,7 @@ public:
VehicleConfigurationHelper(VehicleConfigurationSource *configSource); VehicleConfigurationHelper(VehicleConfigurationSource *configSource);
bool setupVehicle(bool save = true); bool setupVehicle(bool save = true);
bool setupHardwareSettings(bool save = true); bool setupHardwareSettings(bool save = true);
bool isApplicable(UAVObject *object);
static const qint16 LEGACY_ESC_FREQUENCY = 50; static const qint16 LEGACY_ESC_FREQUENCY = 50;
static const qint16 RAPID_ESC_FREQUENCY = 500; static const qint16 RAPID_ESC_FREQUENCY = 500;
static const qint16 ANALOG_SERVO_FREQUENCY = 50; static const qint16 ANALOG_SERVO_FREQUENCY = 50;