mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-12 02:54:15 +01:00
Merge remote-tracking branch 'origin/thread/OP-1589_MixerSettings_Export' into rel-14.10
This commit is contained in:
commit
660470b9e9
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file airframestabfixedwingpage.cpp
|
* @file airframeinitialtuningpage.cpp
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||||
* @addtogroup
|
* @addtogroup
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup AirframeStabFixedwingPage
|
* @addtogroup AirframeInitialTuningPage
|
||||||
* @{
|
* @{
|
||||||
* @brief
|
* @brief
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -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);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* @file airframestabfixedwingpage.h
|
* @file airframeinitialtuningpage.h
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||||
* @addtogroup
|
* @addtogroup
|
||||||
* @{
|
* @{
|
||||||
* @addtogroup AirframeStabFixedwingPage
|
* @addtogroup AirframeInitialTuningPage
|
||||||
* @{
|
* @{
|
||||||
* @brief
|
* @brief
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -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";
|
||||||
@ -111,6 +112,11 @@ QString VehicleTemplateExportDialog::setupVehicleType()
|
|||||||
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_X;
|
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_X;
|
||||||
return tr("Multirotor - Quadrocopter X");
|
return tr("Multirotor - Quadrocopter X");
|
||||||
|
|
||||||
|
case SystemSettings::AIRFRAMETYPE_QUADH:
|
||||||
|
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
|
||||||
|
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_H;
|
||||||
|
return tr("Multirotor - Quadrocopter H");
|
||||||
|
|
||||||
case SystemSettings::AIRFRAMETYPE_QUADP:
|
case SystemSettings::AIRFRAMETYPE_QUADP:
|
||||||
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
|
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
|
||||||
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS;
|
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS;
|
||||||
@ -146,6 +152,11 @@ QString VehicleTemplateExportDialog::setupVehicleType()
|
|||||||
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_X;
|
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_X;
|
||||||
return tr("Multirotor - Hexacopter X");
|
return tr("Multirotor - Hexacopter X");
|
||||||
|
|
||||||
|
case SystemSettings::AIRFRAMETYPE_HEXAH:
|
||||||
|
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
|
||||||
|
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_H;
|
||||||
|
return tr("Multirotor - Hexacopter H");
|
||||||
|
|
||||||
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
|
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
|
||||||
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
|
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
|
||||||
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y;
|
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y;
|
||||||
@ -181,6 +192,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