1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

OP-1222 Uncrustify

This commit is contained in:
Laurent Lalanne 2014-09-16 19:27:18 +02:00
parent d0c9e236a1
commit a8f0bb6eb6
15 changed files with 55 additions and 52 deletions

View File

@ -101,7 +101,7 @@ SixPointCalibrationModel::SixPointCalibrationModel(QObject *parent) :
revoCalibration = RevoCalibration::GetInstance(getObjectManager()); revoCalibration = RevoCalibration::GetInstance(getObjectManager());
Q_ASSERT(revoCalibration); Q_ASSERT(revoCalibration);
auxMagSettings = AuxMagSettings::GetInstance(getObjectManager()); auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
Q_ASSERT(auxMagSettings); Q_ASSERT(auxMagSettings);
accelGyroSettings = AccelGyroSettings::GetInstance(getObjectManager()); accelGyroSettings = AccelGyroSettings::GetInstance(getObjectManager());
@ -440,7 +440,7 @@ void SixPointCalibrationModel::compute()
double Be_length; double Be_length;
RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData(); RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData();
AuxMagSettings::DataFields auxCalibrationData = auxMagSettings->getData(); AuxMagSettings::DataFields auxCalibrationData = auxMagSettings->getData();
AccelGyroSettings::DataFields accelGyroSettingsData = accelGyroSettings->getData(); AccelGyroSettings::DataFields accelGyroSettingsData = accelGyroSettings->getData();
HomeLocation::DataFields homeLocationData = homeLocation->getData(); HomeLocation::DataFields homeLocationData = homeLocation->getData();
@ -521,8 +521,8 @@ void SixPointCalibrationModel::compute()
if (good_calibration) { if (good_calibration) {
m_dirty = true; m_dirty = true;
if (calibratingMag) { if (calibratingMag) {
result.revoCalibrationData = revoCalibrationData; result.revoCalibrationData = revoCalibrationData;
result.auxMagSettingsData = auxCalibrationData; result.auxMagSettingsData = auxCalibrationData;
displayInstructions(tr("Magnetometer calibration completed successfully."), WizardModel::Success); displayInstructions(tr("Magnetometer calibration completed successfully."), WizardModel::Success);
} }
if (calibratingAccel) { if (calibratingAccel) {

View File

@ -92,14 +92,14 @@ public:
UAVObject::Metadata accelStateMetadata; UAVObject::Metadata accelStateMetadata;
UAVObject::Metadata magSensorMetadata; UAVObject::Metadata magSensorMetadata;
UAVObject::Metadata auxMagSensorMetadata; UAVObject::Metadata auxMagSensorMetadata;
AuxMagSettings::DataFields auxMagSettings; AuxMagSettings::DataFields auxMagSettings;
RevoCalibration::DataFields revoCalibrationData; RevoCalibration::DataFields revoCalibrationData;
AccelGyroSettings::DataFields accelGyroSettingsData; AccelGyroSettings::DataFields accelGyroSettingsData;
} Memento; } Memento;
typedef struct { typedef struct {
RevoCalibration::DataFields revoCalibrationData; RevoCalibration::DataFields revoCalibrationData;
AuxMagSettings::DataFields auxMagSettingsData; AuxMagSettings::DataFields auxMagSettingsData;
AccelGyroSettings::DataFields accelGyroSettingsData; AccelGyroSettings::DataFields accelGyroSettingsData;
} Result; } Result;

View File

@ -31,7 +31,7 @@
#include "connectiondiagram.h" #include "connectiondiagram.h"
#include "ui_connectiondiagram.h" #include "ui_connectiondiagram.h"
const char* ConnectionDiagram::FILE_NAME = ":/setupwizard/resources/connection-diagrams.svg"; const char *ConnectionDiagram::FILE_NAME = ":/setupwizard/resources/connection-diagrams.svg";
const int ConnectionDiagram::IMAGE_PADDING = 10; const int ConnectionDiagram::IMAGE_PADDING = 10;
ConnectionDiagram::ConnectionDiagram(QWidget *parent, VehicleConfigurationSource *configSource) : ConnectionDiagram::ConnectionDiagram(QWidget *parent, VehicleConfigurationSource *configSource) :
@ -50,12 +50,14 @@ ConnectionDiagram::~ConnectionDiagram()
void ConnectionDiagram::resizeEvent(QResizeEvent *event) void ConnectionDiagram::resizeEvent(QResizeEvent *event)
{ {
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
fitInView(); fitInView();
} }
void ConnectionDiagram::showEvent(QShowEvent *event) void ConnectionDiagram::showEvent(QShowEvent *event)
{ {
QWidget::showEvent(event); QWidget::showEvent(event);
fitInView(); fitInView();
} }
@ -63,8 +65,8 @@ void ConnectionDiagram::fitInView()
{ {
ui->connectionDiagram->setSceneRect(m_scene->itemsBoundingRect()); ui->connectionDiagram->setSceneRect(m_scene->itemsBoundingRect());
ui->connectionDiagram->fitInView( ui->connectionDiagram->fitInView(
m_scene->itemsBoundingRect().adjusted(-IMAGE_PADDING,-IMAGE_PADDING, IMAGE_PADDING, IMAGE_PADDING), m_scene->itemsBoundingRect().adjusted(-IMAGE_PADDING, -IMAGE_PADDING, IMAGE_PADDING, IMAGE_PADDING),
Qt::KeepAspectRatio); Qt::KeepAspectRatio);
} }
void ConnectionDiagram::setupGraphicsScene() void ConnectionDiagram::setupGraphicsScene()
@ -210,7 +212,7 @@ void ConnectionDiagram::setupGraphicsScene()
} }
if (m_configSource->getVehicleType() == VehicleConfigurationSource::VEHICLE_FIXEDWING && if (m_configSource->getVehicleType() == VehicleConfigurationSource::VEHICLE_FIXEDWING &&
m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_ESTIMATE) { m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_ESTIMATE) {
switch (m_configSource->getAirspeedType()) { switch (m_configSource->getAirspeedType()) {
case VehicleConfigurationSource::AIRSPEED_EAGLETREE: case VehicleConfigurationSource::AIRSPEED_EAGLETREE:
if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) {

View File

@ -40,14 +40,14 @@ void AirSpeedPage::initializePage(VehicleConfigurationSource *settings)
// Enable all // Enable all
setItemDisabled(-1, false); setItemDisabled(-1, false);
if (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS || if (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSM2 || settings->getInputType() == VehicleConfigurationSource::INPUT_DSM2 ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX10 || settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX10 ||
settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX11) { settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX11) {
// Disable non estimated sensors if ports are taken by receivers // Disable non estimated sensors if ports are taken by receivers
setItemDisabled(VehicleConfigurationSource::AIRSPEED_EAGLETREE, true); setItemDisabled(VehicleConfigurationSource::AIRSPEED_EAGLETREE, true);
setItemDisabled(VehicleConfigurationSource::AIRSPEED_MS4525, true); setItemDisabled(VehicleConfigurationSource::AIRSPEED_MS4525, true);
if (getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_EAGLETREE || if (getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_EAGLETREE ||
getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_MS4525) { getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_MS4525) {
// If previously selected invalid sensor, reset to estimated // If previously selected invalid sensor, reset to estimated
setSelectedItem(VehicleConfigurationSource::AIRSPEED_ESTIMATE); setSelectedItem(VehicleConfigurationSource::AIRSPEED_ESTIMATE);
} }
@ -90,4 +90,3 @@ void AirSpeedPage::setupSelection(Selection *selection)
"ms4525-speed-sensor", "ms4525-speed-sensor",
SetupWizard::AIRSPEED_MS4525); SetupWizard::AIRSPEED_MS4525);
} }

View File

@ -41,7 +41,6 @@ protected:
void initializePage(VehicleConfigurationSource *settings); void initializePage(VehicleConfigurationSource *settings);
bool validatePage(SelectionItem *selectedItem); bool validatePage(SelectionItem *selectedItem);
void setupSelection(Selection *selection); void setupSelection(Selection *selection);
}; };
#endif // AIRSPEEDPAGE_H #endif // AIRSPEEDPAGE_H

View File

@ -79,7 +79,7 @@ void MultiPage::setupSelection(Selection *selection)
selection->addItem(tr("Quadcopter H"), selection->addItem(tr("Quadcopter H"),
tr("Quadcopter H, Blackout miniH"), tr("Quadcopter H, Blackout miniH"),
"quad-h", "quad-h",
SetupWizard::MULTI_ROTOR_QUAD_H); SetupWizard::MULTI_ROTOR_QUAD_H);
selection->addItem(tr("Hexacopter"), selection->addItem(tr("Hexacopter"),
tr("A multirotor with six motors, one motor in front."), tr("A multirotor with six motors, one motor in front."),

View File

@ -58,10 +58,12 @@ public:
{ {
return m_id; return m_id;
} }
void setDisabled(bool disabled) { void setDisabled(bool disabled)
{
m_disabled = disabled; m_disabled = disabled;
} }
bool disabled() { bool disabled()
{
return m_disabled; return m_disabled;
} }

View File

@ -26,16 +26,16 @@
guidetolerance="10" guidetolerance="10"
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1280" inkscape:window-width="593"
inkscape:window-height="928" inkscape:window-height="439"
id="namedview4616" id="namedview4616"
showgrid="false" showgrid="false"
inkscape:zoom="0.54491305" inkscape:zoom="0.1891554"
inkscape:cx="1013.827" inkscape:cx="1013.827"
inkscape:cy="514.92134" inkscape:cy="514.92134"
inkscape:window-x="0" inkscape:window-x="331"
inkscape:window-y="27" inkscape:window-y="337"
inkscape:window-maximized="1" inkscape:window-maximized="0"
inkscape:current-layer="layer7" inkscape:current-layer="layer7"
fit-margin-top="15" fit-margin-top="15"
fit-margin-left="15" fit-margin-left="15"
@ -29307,7 +29307,8 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer7" id="layer7"
inkscape:label="quad-h" inkscape:label="quad-h"
style="display:inline"> style="display:inline"
sodipodi:insensitive="true">
<g <g
style="display:inline" style="display:inline"
id="quad-h" id="quad-h"

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@ -191,6 +191,7 @@ int SetupWizard::nextId() const
switch (getVehicleType()) { switch (getVehicleType()) {
case VEHICLE_FIXEDWING: case VEHICLE_FIXEDWING:
return PAGE_OUTPUT_CALIBRATION; return PAGE_OUTPUT_CALIBRATION;
default: default:
return PAGE_BIAS_CALIBRATION; return PAGE_BIAS_CALIBRATION;
} }

View File

@ -68,9 +68,9 @@ bool SetupWizardPlugin::initialize(const QStringList & args, QString *errMsg)
ac->addAction(cmd, "Wizard"); ac->addAction(cmd, "Wizard");
cmd = am->registerAction(new QAction(this), cmd = am->registerAction(new QAction(this),
"SetupWizardPlugin.ExportJSon", "SetupWizardPlugin.ExportJSon",
QList<int>() << QList<int>() <<
Core::Constants::C_GLOBAL_ID); Core::Constants::C_GLOBAL_ID);
cmd->action()->setText(tr("Export Stabilization Settings")); cmd->action()->setText(tr("Export Stabilization Settings"));
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportSettings())); connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportSettings()));
@ -114,12 +114,11 @@ void SetupWizardPlugin::exportSettings()
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
StabilizationSettings* settings = StabilizationSettings::GetInstance(uavoManager); StabilizationSettings *settings = StabilizationSettings::GetInstance(uavoManager);
settings->toJson(exportObject); settings->toJson(exportObject);
QJsonDocument saveDoc(exportObject); QJsonDocument saveDoc(exportObject);
saveFile.write(saveDoc.toJson()); saveFile.write(saveDoc.toJson());
} }
void SetupWizardPlugin::wizardTerminated() void SetupWizardPlugin::wizardTerminated()

View File

@ -116,6 +116,7 @@ void VehicleConfigurationHelper::clearModifiedObjects()
void VehicleConfigurationHelper::applyHardwareConfiguration() void VehicleConfigurationHelper::applyHardwareConfiguration()
{ {
HwSettings *hwSettings = HwSettings::GetInstance(m_uavoManager); HwSettings *hwSettings = HwSettings::GetInstance(m_uavoManager);
Q_ASSERT(hwSettings); Q_ASSERT(hwSettings);
HwSettings::DataFields data = hwSettings->getData(); HwSettings::DataFields data = hwSettings->getData();
@ -193,7 +194,6 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
} }
if (m_configSource->getGpsType() != VehicleConfigurationSource::GPS_DISABLED) { if (m_configSource->getGpsType() != VehicleConfigurationSource::GPS_DISABLED) {
GPSSettings *gpsSettings = GPSSettings::GetInstance(m_uavoManager); GPSSettings *gpsSettings = GPSSettings::GetInstance(m_uavoManager);
Q_ASSERT(gpsSettings); Q_ASSERT(gpsSettings);
GPSSettings::DataFields gpsData = gpsSettings->getData(); GPSSettings::DataFields gpsData = gpsSettings->getData();
@ -201,28 +201,28 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
switch (m_configSource->getGpsType()) { switch (m_configSource->getGpsType()) {
case VehicleConfigurationSource::GPS_NMEA: case VehicleConfigurationSource::GPS_NMEA:
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1;
data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; data.RM_MainPort = HwSettings::RM_MAINPORT_GPS;
data.GPSSpeed = HwSettings::GPSSPEED_57600; data.GPSSpeed = HwSettings::GPSSPEED_57600;
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_NMEA; gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_NMEA;
break; break;
case VehicleConfigurationSource::GPS_UBX: case VehicleConfigurationSource::GPS_UBX:
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1;
data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; data.RM_MainPort = HwSettings::RM_MAINPORT_GPS;
data.GPSSpeed = HwSettings::GPSSPEED_57600; data.GPSSpeed = HwSettings::GPSSPEED_57600;
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX; gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX;
break; break;
case VehicleConfigurationSource::GPS_PLATINUM: case VehicleConfigurationSource::GPS_PLATINUM:
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1;
data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; data.RM_MainPort = HwSettings::RM_MAINPORT_GPS;
data.GPSSpeed = HwSettings::GPSSPEED_115200; data.GPSSpeed = HwSettings::GPSSPEED_115200;
/* /*
gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBLOX; gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBLOX;
AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager); AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager);
AuxMagSettings::DataFields magsData = magSettings->getData(); AuxMagSettings::DataFields magsData = magSettings->getData();
magsData.usage = AuxMagSettings::Both; magsData.usage = AuxMagSettings::Both;
magSettings->setData(magsData); magSettings->setData(magsData);
addModifiedObject(magSettings, tr("Writing External Mag sensor settings")); addModifiedObject(magSettings, tr("Writing External Mag sensor settings"));
*/ */
break; break;
default: default:
data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 0; data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 0;
@ -234,8 +234,7 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
} }
if (m_configSource->getVehicleType() == VehicleConfigurationSource::VEHICLE_FIXEDWING && if (m_configSource->getVehicleType() == VehicleConfigurationSource::VEHICLE_FIXEDWING &&
m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_DISABLED) { m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_DISABLED) {
AirspeedSettings *airspeedSettings = AirspeedSettings::GetInstance(m_uavoManager); AirspeedSettings *airspeedSettings = AirspeedSettings::GetInstance(m_uavoManager);
Q_ASSERT(airspeedSettings); Q_ASSERT(airspeedSettings);
AirspeedSettings::DataFields airspeedData = airspeedSettings->getData(); AirspeedSettings::DataFields airspeedData = airspeedSettings->getData();

View File

@ -542,7 +542,7 @@ void UAVObject::fromXML(QXmlStreamReader *xmlReader)
Q_ASSERT(xmlReader->attributes().value("name") == getName()); Q_ASSERT(xmlReader->attributes().value("name") == getName());
Q_ASSERT(xmlReader->attributes().value("instance") == QString("%1").arg(getInstID())); Q_ASSERT(xmlReader->attributes().value("instance") == QString("%1").arg(getInstID()));
QXmlStreamReader::TokenType token = xmlReader->readNext(); QXmlStreamReader::TokenType token = xmlReader->readNext();
if(token == QXmlStreamReader::StartElement && xmlReader->name() == "fields") { if (token == QXmlStreamReader::StartElement && xmlReader->name() == "fields") {
while (xmlReader->readNextStartElement()) { while (xmlReader->readNextStartElement()) {
if (xmlReader->name() == "field") { if (xmlReader->name() == "field") {
QStringRef fieldName = xmlReader->attributes().value("name"); QStringRef fieldName = xmlReader->attributes().value("name");
@ -556,12 +556,13 @@ void UAVObject::fromXML(QXmlStreamReader *xmlReader)
void UAVObject::toJson(QJsonObject &jsonObject) void UAVObject::toJson(QJsonObject &jsonObject)
{ {
jsonObject["name"] = getName(); jsonObject["name"] = getName();
jsonObject["id"] = QString("%1").arg(getObjID(), 1, 16).toUpper(); jsonObject["id"] = QString("%1").arg(getObjID(), 1, 16).toUpper();
jsonObject["instance"] = (int)getInstID(); jsonObject["instance"] = (int)getInstID();
QJsonArray jSonFields; QJsonArray jSonFields;
foreach(UAVObjectField * field, fields) { foreach(UAVObjectField * field, fields) {
QJsonObject jSonField; QJsonObject jSonField;
field->toJson(jSonField); field->toJson(jSonField);
jSonFields.append(jSonField); jSonFields.append(jSonField);
} }

View File

@ -698,7 +698,7 @@ void UAVObjectField::toJson(QJsonObject &jsonObject)
QJsonArray values; QJsonArray values;
for (unsigned int n = 0; n < numElements; ++n) { for (unsigned int n = 0; n < numElements; ++n) {
QJsonObject value; QJsonObject value;
value["name"] = getElementNames().at(n); value["name"] = getElementNames().at(n);
value["value"] = QJsonValue::fromVariant(getValue(n)); value["value"] = QJsonValue::fromVariant(getValue(n));
values.append(value); values.append(value);
} }