mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
OP-1589 Added MixerSettings to export.
Made Quad-X and Qyad-H compatible when importing settings.
This commit is contained in:
parent
2016f1bc43
commit
97dad5ce71
@ -151,6 +151,25 @@ void AirframeInitialTuningPage::templateSelectionChanged()
|
||||
}
|
||||
}
|
||||
|
||||
bool AirframeInitialTuningPage::airframeIsCompatible(int vehicleType, int vehicleSubType)
|
||||
{
|
||||
if (vehicleType != getWizard()->getVehicleType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int wizSubType = getWizard()->getVehicleSubType();
|
||||
switch (vehicleType) {
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_H:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X:
|
||||
{
|
||||
return wizSubType == VehicleConfigurationSource::MULTI_ROTOR_QUAD_H ||
|
||||
wizSubType == VehicleConfigurationSource::MULTI_ROTOR_QUAD_X;
|
||||
}
|
||||
default:
|
||||
return vehicleSubType == wizSubType;
|
||||
}
|
||||
}
|
||||
|
||||
void AirframeInitialTuningPage::loadValidFiles()
|
||||
{
|
||||
ui->templateList->clear();
|
||||
@ -174,8 +193,7 @@ void AirframeInitialTuningPage::loadValidFiles()
|
||||
QJsonDocument templateDoc = QJsonDocument::fromJson(jsonData, &error);
|
||||
if (error.error == QJsonParseError::NoError) {
|
||||
QJsonObject json = templateDoc.object();
|
||||
if (json["type"].toInt() == getWizard()->getVehicleType() &&
|
||||
json["subtype"].toInt() == getWizard()->getVehicleSubType()) {
|
||||
if (airframeIsCompatible(json["type"].toInt(), json["subtype"].toInt())) {
|
||||
QString uuid = json["uuid"].toString();
|
||||
if (!m_templates.contains(uuid)) {
|
||||
m_templates[json["uuid"].toString()] = new QJsonObject(json);
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
QString getTemplateKey(QJsonObject *templ);
|
||||
void updatePhoto(QJsonObject *templ);
|
||||
void updateDescription(QJsonObject *templ);
|
||||
bool airframeIsCompatible(int vehicleType, int vehicleSubType);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QJsonObject *)
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "stabilizationsettingsbank1.h"
|
||||
#include "stabilizationsettingsbank2.h"
|
||||
#include "stabilizationsettingsbank3.h"
|
||||
#include "mixersettings.h"
|
||||
#include "ekfconfiguration.h"
|
||||
|
||||
const char *VehicleTemplateExportDialog::EXPORT_BASE_NAME = "../share/openpilotgcs/cloudconfig";
|
||||
@ -181,6 +182,7 @@ void VehicleTemplateExportDialog::accept()
|
||||
objectsToExport << StabilizationSettingsBank1::GetInstance(m_uavoManager);
|
||||
objectsToExport << StabilizationSettingsBank2::GetInstance(m_uavoManager);
|
||||
objectsToExport << StabilizationSettingsBank3::GetInstance(m_uavoManager);
|
||||
objectsToExport << MixerSettings::GetInstance(m_uavoManager);
|
||||
objectsToExport << EKFConfiguration::GetInstance(m_uavoManager);
|
||||
m_uavoManager->toJson(exportObject, objectsToExport);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user