mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
OP-1592 New filtering method as requested in review
This commit is contained in:
parent
49869d9598
commit
8cc95451a5
@ -98,6 +98,22 @@ bool VehicleConfigurationHelper::setupHardwareSettings(bool save)
|
||||
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)
|
||||
{
|
||||
m_modifiedObjects << new QPair<UAVDataObject *, QString>(object, description);
|
||||
@ -752,16 +768,8 @@ void VehicleConfigurationHelper::applyTemplateSettings()
|
||||
foreach(UAVObject * object, updatedObjects) {
|
||||
UAVDataObject *dataObj = dynamic_cast<UAVDataObject *>(object);
|
||||
|
||||
// Do not apply EKFConfiguration for CC and CC3D boards
|
||||
if (dataObj != NULL) {
|
||||
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()));
|
||||
}
|
||||
if (dataObj != NULL && isApplicable(object)) {
|
||||
addModifiedObject(dataObj, tr("Writing template settings for %1").arg(object->getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
VehicleConfigurationHelper(VehicleConfigurationSource *configSource);
|
||||
bool setupVehicle(bool save = true);
|
||||
bool setupHardwareSettings(bool save = true);
|
||||
bool isApplicable(UAVObject *object);
|
||||
static const qint16 LEGACY_ESC_FREQUENCY = 50;
|
||||
static const qint16 RAPID_ESC_FREQUENCY = 500;
|
||||
static const qint16 ANALOG_SERVO_FREQUENCY = 50;
|
||||
|
Loading…
Reference in New Issue
Block a user