mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-04-11 03:02:20 +02: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()
|
void AirframeInitialTuningPage::loadValidFiles()
|
||||||
{
|
{
|
||||||
ui->templateList->clear();
|
ui->templateList->clear();
|
||||||
@ -174,8 +193,7 @@ void AirframeInitialTuningPage::loadValidFiles()
|
|||||||
QJsonDocument templateDoc = QJsonDocument::fromJson(jsonData, &error);
|
QJsonDocument templateDoc = QJsonDocument::fromJson(jsonData, &error);
|
||||||
if (error.error == QJsonParseError::NoError) {
|
if (error.error == QJsonParseError::NoError) {
|
||||||
QJsonObject json = templateDoc.object();
|
QJsonObject json = templateDoc.object();
|
||||||
if (json["type"].toInt() == getWizard()->getVehicleType() &&
|
if (airframeIsCompatible(json["type"].toInt(), json["subtype"].toInt())) {
|
||||||
json["subtype"].toInt() == getWizard()->getVehicleSubType()) {
|
|
||||||
QString uuid = json["uuid"].toString();
|
QString uuid = json["uuid"].toString();
|
||||||
if (!m_templates.contains(uuid)) {
|
if (!m_templates.contains(uuid)) {
|
||||||
m_templates[json["uuid"].toString()] = new QJsonObject(json);
|
m_templates[json["uuid"].toString()] = new QJsonObject(json);
|
||||||
|
@ -63,6 +63,7 @@ private:
|
|||||||
QString getTemplateKey(QJsonObject *templ);
|
QString getTemplateKey(QJsonObject *templ);
|
||||||
void updatePhoto(QJsonObject *templ);
|
void updatePhoto(QJsonObject *templ);
|
||||||
void updateDescription(QJsonObject *templ);
|
void updateDescription(QJsonObject *templ);
|
||||||
|
bool airframeIsCompatible(int vehicleType, int vehicleSubType);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QJsonObject *)
|
Q_DECLARE_METATYPE(QJsonObject *)
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "stabilizationsettingsbank1.h"
|
#include "stabilizationsettingsbank1.h"
|
||||||
#include "stabilizationsettingsbank2.h"
|
#include "stabilizationsettingsbank2.h"
|
||||||
#include "stabilizationsettingsbank3.h"
|
#include "stabilizationsettingsbank3.h"
|
||||||
|
#include "mixersettings.h"
|
||||||
#include "ekfconfiguration.h"
|
#include "ekfconfiguration.h"
|
||||||
|
|
||||||
const char *VehicleTemplateExportDialog::EXPORT_BASE_NAME = "../share/openpilotgcs/cloudconfig";
|
const char *VehicleTemplateExportDialog::EXPORT_BASE_NAME = "../share/openpilotgcs/cloudconfig";
|
||||||
@ -181,6 +182,7 @@ void VehicleTemplateExportDialog::accept()
|
|||||||
objectsToExport << StabilizationSettingsBank1::GetInstance(m_uavoManager);
|
objectsToExport << StabilizationSettingsBank1::GetInstance(m_uavoManager);
|
||||||
objectsToExport << StabilizationSettingsBank2::GetInstance(m_uavoManager);
|
objectsToExport << StabilizationSettingsBank2::GetInstance(m_uavoManager);
|
||||||
objectsToExport << StabilizationSettingsBank3::GetInstance(m_uavoManager);
|
objectsToExport << StabilizationSettingsBank3::GetInstance(m_uavoManager);
|
||||||
|
objectsToExport << MixerSettings::GetInstance(m_uavoManager);
|
||||||
objectsToExport << EKFConfiguration::GetInstance(m_uavoManager);
|
objectsToExport << EKFConfiguration::GetInstance(m_uavoManager);
|
||||||
m_uavoManager->toJson(exportObject, objectsToExport);
|
m_uavoManager->toJson(exportObject, objectsToExport);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user