1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merge branch 'next' into corvuscorax/OP-1216_flight-control-refurbishment

This commit is contained in:
Corvus Corax 2014-03-08 15:52:45 +01:00
commit 82a196b8cf
74 changed files with 354 additions and 216 deletions

View File

@ -211,6 +211,7 @@ inline QString msgSendArgumentFailed()
void mainMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
Q_UNUSED(context);
QFile file(QDir::tempPath() + "/gcs.log");
if (file.open(QIODevice::Append | QIODevice::Text)) {

View File

@ -229,7 +229,7 @@ template<typename T, bool Align> inline void ei_conditional_aligned_delete(T *pt
template<typename Scalar, typename Integer>
inline static Integer ei_alignmentOffset(const Scalar* array, Integer size)
{
typedef typename ei_packet_traits<Scalar>::type Packet;
typedef typename ei_packet_traits<Scalar>::type Packet __attribute__ ((unused));
enum { PacketSize = ei_packet_traits<Scalar>::size,
PacketAlignedMask = PacketSize-1
};

View File

@ -34,7 +34,7 @@ using namespace projections;
namespace internals {
Core::Core() : MouseWheelZooming(false), currentPosition(0, 0), currentPositionPixel(0, 0), LastLocationInBounds(-1, -1), sizeOfMapArea(0, 0)
, minOfTiles(0, 0), maxOfTiles(0, 0), zoom(0), isDragging(false), TooltipTextPadding(10, 10), loaderLimit(5), maxzoom(21), started(false), runningThreads(0)
, minOfTiles(0, 0), maxOfTiles(0, 0), zoom(0), isDragging(false), TooltipTextPadding(10, 10), loaderLimit(5), maxzoom(21), runningThreads(0), started(false)
{
mousewheelzoomtype = MouseWheelZoomType::MousePositionAndCenter;
SetProjection(new MercatorProjection());

View File

@ -88,14 +88,15 @@ QVector <double> LKS94Projection::DTM10(const QVector <double> & lonlat)
double es; // Eccentricity squared : (a^2 - b^2)/a^2
double semiMajor = 6378137.0; // major axis
double semiMinor = 6356752.3142451793; // minor axis
double ab; // Semi_major / semi_minor
double ba; // Semi_minor / semi_major
double ses; // Second eccentricity squared : (a^2 - b^2)/b^2
es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); // e^2
ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2);
ba = semiMinor / semiMajor;
ab = semiMajor / semiMinor;
// double ab; // Semi_major / semi_minor
// double ba; // Semi_minor / semi_major
// double ses; // Second eccentricity squared : (a^2 - b^2)/b^2
es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); // e^2
// ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2);
// ba = semiMinor / semiMajor;
// ab = semiMajor / semiMinor;
// ...
@ -121,14 +122,14 @@ QVector <double> LKS94Projection::MTD10(QVector <double> & pnt)
double es; // Eccentricity squared : (a^2 - b^2)/a^2
double semiMajor = 6378137.0; // major axis
double semiMinor = 6356752.3141403561; // minor axis
double ab; // Semi_major / semi_minor
double ba; // Semi_minor / semi_major
// double ab; // Semi_major / semi_minor
// double ba; // Semi_minor / semi_major
double ses; // Second eccentricity squared : (a^2 - b^2)/b^2
es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); // e^2
ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2);
ba = semiMinor / semiMajor;
ab = semiMajor / semiMinor;
// ba = semiMinor / semiMajor;
// ab = semiMajor / semiMinor;
// ...
@ -201,11 +202,13 @@ QVector <double> LKS94Projection::DTM00(QVector <double> & lonlat)
double metersPerUnit = 1.0;
double e0, e1, e2, e3; // eccentricity constants
double e, es, esp; // eccentricity constants
// double e;
double es;
double esp; // eccentricity constants
double ml0; // small value m
es = 1.0 - pow(semiMinor / semiMajor, 2);
e = sqrt(es);
// e = sqrt(es);
e0 = e0fn(es);
e1 = e1fn(es);
e2 = e2fn(es);
@ -262,14 +265,15 @@ QVector <double> LKS94Projection::DTM01(QVector <double> & lonlat)
double es; // Eccentricity squared : (a^2 - b^2)/a^2
double semiMajor = 6378137.0; // major axis
double semiMinor = 6356752.3141403561; // minor axis
double ab; // Semi_major / semi_minor
double ba; // Semi_minor / semi_major
double ses; // Second eccentricity squared : (a^2 - b^2)/b^2
es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor);
ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2);
ba = semiMinor / semiMajor;
ab = semiMajor / semiMinor;
// double ab; // Semi_major / semi_minor
// double ba; // Semi_minor / semi_major
// double ses; // Second eccentricity squared : (a^2 - b^2)/b^2
es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor);
// ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2);
// ba = semiMinor / semiMajor;
// ab = semiMajor / semiMinor;
// ...
@ -294,14 +298,14 @@ QVector <double> LKS94Projection::MTD01(QVector <double> & pnt)
double es; // Eccentricity squared : (a^2 - b^2)/a^2
double semiMajor = 6378137.0; // major axis
double semiMinor = 6356752.3142451793; // minor axis
double ab; // Semi_major / semi_minor
double ba; // Semi_minor / semi_major
// double ab; // Semi_major / semi_minor
// double ba; // Semi_minor / semi_major
double ses; // Second eccentricity squared : (a^2 - b^2)/b^2
es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor);
ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2);
ba = semiMinor / semiMajor;
ab = semiMajor / semiMinor;
// ba = semiMinor / semiMajor;
// ab = semiMajor / semiMinor;
// ...
@ -378,12 +382,14 @@ QVector <double> LKS94Projection::MTD11(QVector <double> & p)
double metersPerUnit = 1.0;
double e0, e1, e2, e3; // eccentricity constants
double e, es, esp; // eccentricity constants
// double e;
double es;
double esp; // eccentricity constants
double ml0; // small value m
es = (semiMinor * semiMinor) / (semiMajor * semiMajor);
es = 1.0 - es;
e = sqrt(es);
// e = sqrt(es);
e0 = e0fn(es);
e1 = e1fn(es);
e2 = e2fn(es);

View File

@ -56,7 +56,7 @@ Point MercatorProjectionYandex::FromLatLngToPixel(double lat, double lng, const
}
internals::PointLatLng MercatorProjectionYandex::FromPixelToLatLng(const int &x, const int &y, const int &zoom)
{
Size s = GetTileMatrixSizePixel(zoom);
// Size s = GetTileMatrixSizePixel(zoom);
// double mapSizeX = s.Width();
// double mapSizeY = s.Height();

View File

@ -31,7 +31,8 @@
#include <QGraphicsSceneMouseEvent>
namespace mapcontrol {
MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration) : core(core), config(configuration), MapRenderTransform(1), maxZoom(17), minZoom(2), zoomReal(0), isSelected(false), rotation(0), zoomDigi(0)
MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration) : core(core), config(configuration), MapRenderTransform(1),
maxZoom(17), minZoom(2), zoomReal(0), zoomDigi(0), isSelected(false), rotation(0)
{
dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg"));
showTileGridLines = false;

View File

@ -31,8 +31,8 @@
namespace mapcontrol {
double UAVItem::groundspeed_mps_filt = 0;
UAVItem::UAVItem(MapGraphicItem *map, OPMapWidget *parent, QString uavPic) : map(map), mapwidget(parent), showtrail(true), showtrailline(true), trailtime(5), traildistance(50), autosetreached(true)
, autosetdistance(100), altitude(0), showUAVInfo(false)
UAVItem::UAVItem(MapGraphicItem *map, OPMapWidget *parent, QString uavPic) : map(map), mapwidget(parent), altitude(0), showtrail(true), showtrailline(true),
trailtime(5), traildistance(50), autosetreached(true), autosetdistance(100), showUAVInfo(false)
{
pic.load(uavPic);
this->setFlag(QGraphicsItem::ItemIsMovable, false);

View File

@ -29,8 +29,8 @@
#include "homeitem.h"
namespace mapcontrol {
WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool clockwise, MapGraphicItem *map, QColor color) : my_center(center),
my_radius(radius), my_map(map), QGraphicsEllipseItem(map), myColor(color), myClockWise(clockwise)
WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool clockwise, MapGraphicItem *map, QColor color) : QGraphicsEllipseItem(map),
my_center(center), my_radius(radius), my_map(map), myColor(color), myClockWise(clockwise)
{
connect(center, SIGNAL(localPositionChanged(QPointF, WayPointItem *)), this, SLOT(refreshLocations()));
connect(radius, SIGNAL(localPositionChanged(QPointF, WayPointItem *)), this, SLOT(refreshLocations()));
@ -40,8 +40,8 @@ WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
}
WayPointCircle::WayPointCircle(HomeItem *radius, WayPointItem *center, bool clockwise, MapGraphicItem *map, QColor color) : my_center(center),
my_radius(radius), my_map(map), QGraphicsEllipseItem(map), myColor(color), myClockWise(clockwise)
WayPointCircle::WayPointCircle(HomeItem *radius, WayPointItem *center, bool clockwise, MapGraphicItem *map, QColor color) : QGraphicsEllipseItem(map),
my_center(center), my_radius(radius), my_map(map), myColor(color), myClockWise(clockwise)
{
connect(radius, SIGNAL(homePositionChanged(internals::PointLatLng, float)), this, SLOT(refreshLocations()));
connect(center, SIGNAL(localPositionChanged(QPointF)), this, SLOT(refreshLocations()));

View File

@ -337,7 +337,7 @@ void WayPointItem::SetReached(const bool &value)
picture.load(QString::fromUtf8(":/markers/images/bigMarkerGreen.png"));
} else {
if (!isMagic) {
if (this->flags() & QGraphicsItem::ItemIsMovable == QGraphicsItem::ItemIsMovable) {
if ((this->flags() & QGraphicsItem::ItemIsMovable) == QGraphicsItem::ItemIsMovable) {
picture.load(QString::fromUtf8(":/markers/images/marker.png"));
} else {
picture.load(QString::fromUtf8(":/markers/images/waypoint_marker2.png"));

View File

@ -29,8 +29,8 @@
#include "homeitem.h"
namespace mapcontrol {
WayPointLine::WayPointLine(WayPointItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : source(from),
destination(to), my_map(map), QGraphicsLineItem(map), myColor(color)
WayPointLine::WayPointLine(WayPointItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : QGraphicsLineItem(map),
source(from), destination(to), my_map(map), myColor(color)
{
this->setLine(to->pos().x(), to->pos().y(), from->pos().x(), from->pos().y());
connect(from, SIGNAL(localPositionChanged(QPointF, WayPointItem *)), this, SLOT(refreshLocations()));
@ -47,8 +47,8 @@ WayPointLine::WayPointLine(WayPointItem *from, WayPointItem *to, MapGraphicItem
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
}
WayPointLine::WayPointLine(HomeItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : source(from),
destination(to), my_map(map), QGraphicsLineItem(map), myColor(color)
WayPointLine::WayPointLine(HomeItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : QGraphicsLineItem(map),
source(from), destination(to), my_map(map), myColor(color)
{
this->setLine(to->pos().x(), to->pos().y(), from->pos().x(), from->pos().y());
connect(from, SIGNAL(homePositionChanged(internals::PointLatLng, float)), this, SLOT(refreshLocations()));

View File

@ -27,6 +27,9 @@ else {
CONFIG += staticlib
}
# disable all warnings (no need for warnings as qwt sources are imported)
CONFIG += exceptions warn_off
unix:!mac:LIBS += -lrt
HEADERS += \

View File

@ -105,7 +105,7 @@ void LogFile::timerFired()
// TODO: going back in time will be a problem
while ((m_lastPlayed + ((time - m_timeOffset) * m_playbackSpeed) > m_lastTimeStamp)) {
m_lastPlayed += ((time - m_timeOffset) * m_playbackSpeed);
if (m_file.bytesAvailable() < sizeof(dataSize)) {
if (m_file.bytesAvailable() < (qint64)sizeof(dataSize)) {
stopReplay();
return;
}
@ -129,7 +129,7 @@ void LogFile::timerFired()
emit readyRead();
if (m_file.bytesAvailable() < sizeof(m_lastTimeStamp)) {
if (m_file.bytesAvailable() < (qint64)sizeof(m_lastTimeStamp)) {
stopReplay();
return;
}

View File

@ -63,7 +63,7 @@ bool XmlConfig::readXmlFile(QIODevice &device, QSettings::SettingsMap &map)
.arg(errorLine)
.arg(errorColumn)
.arg(errorStr);
qFatal(err.toLatin1().data());
qFatal("%s", err.toLatin1().data());
return false;
}
root = domDoc.documentElement();
@ -99,7 +99,7 @@ void XmlConfig::handleNode(QDomElement *node, QSettings::SettingsMap &map, QStri
}
// qDebug() << "Node: " << ": " << path << " Children: " << node->childNodes().length();
for (uint i = 0; i < node->childNodes().length(); ++i) {
for (int i = 0; i < node->childNodes().length(); ++i) {
QDomNode child = node->childNodes().item(i);
if (child.isElement()) {
handleNode(static_cast<QDomElement *>(&child), map, path);

View File

@ -1447,7 +1447,7 @@ void ConfigCcpmWidget::setSwashplateLevel(int percent)
ActuatorCommand::DataFields actuatorCommandData = actuatorCommand->getData();
for (int i = 0; i < CCPM_MAX_SWASH_SERVOS; i++) {
double value;
double value = 0;
if (level == 0) {
value = newSwashLvlConfiguration.Neutral[i];
} else if (level > 0) {

View File

@ -78,6 +78,7 @@ ConfigCustomWidget::~ConfigCustomWidget()
void ConfigCustomWidget::setupUI(QString frameType)
{
Q_UNUSED(frameType);
Q_ASSERT(m_aircraft);
}
@ -91,7 +92,9 @@ void ConfigCustomWidget::registerWidgets(ConfigTaskWidget &parent)
}
void ConfigCustomWidget::resetActuators(GUIConfigDataUnion *configData)
{}
{
Q_UNUSED(configData);
}
/**
Helper function to refresh the UI widget values
@ -219,6 +222,7 @@ QString ConfigCustomWidget::updateConfigObjectsFromWidgets()
*/
bool ConfigCustomWidget::throwConfigError(int numMotors)
{
Q_UNUSED(numMotors);
return false;
}
@ -265,6 +269,8 @@ SpinBoxDelegate::SpinBoxDelegate(QObject *parent) :
QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
QSpinBox *editor = new QSpinBox(parent);
editor->setMinimum(-127);
@ -295,5 +301,6 @@ void SpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, c
void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
Q_UNUSED(index);
editor->setGeometry(option.rect);
}

View File

@ -86,7 +86,6 @@ void VehicleConfig::setConfigData(GUIConfigDataUnion configData)
// get an instance of systemsettings
SystemSettings *systemSettings = SystemSettings::GetInstance(getUAVObjectManager());
Q_ASSERT(systemSettings);
SystemSettings::DataFields systemSettingsData = systemSettings->getData();
UAVObjectField *guiConfig = systemSettings->getField("GUIConfigData");
Q_ASSERT(guiConfig);

View File

@ -214,6 +214,7 @@ void ConfigCCAttitudeWidget::openHelp()
void ConfigCCAttitudeWidget::setAccelFiltering(bool active)
{
Q_UNUSED(active);
setDirty(true);
}

View File

@ -914,7 +914,7 @@ void ConfigInputWidget::setMoveFromCommand(int command)
// CHANNELNUMBER_ACCESSORY1=6,
// CHANNELNUMBER_ACCESSORY2=7
txMovements movement;
txMovements movement = moveLeftVerticalStick;
switch (command) {
case ManualControlSettings::CHANNELNUMBER_ROLL:
@ -1032,10 +1032,10 @@ void ConfigInputWidget::setTxMovement(txMovements movement)
void ConfigInputWidget::moveTxControls()
{
QTransform trans;
QGraphicsItem *item;
txMovementType move;
int limitMax;
int limitMin;
QGraphicsItem *item = NULL;
txMovementType move = vertical;
int limitMax = 0;
int limitMin = 0;
static bool auxFlag = false;
switch (currentMovement) {

View File

@ -896,11 +896,8 @@ void ConfigRevoWidget::doStartNoiseMeasurement()
Q_UNUSED(lock);
RevoCalibration *revoCalibration = RevoCalibration::GetInstance(getObjectManager());
HomeLocation *homeLocation = HomeLocation::GetInstance(getObjectManager());
Q_ASSERT(revoCalibration);
Q_ASSERT(homeLocation);
RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData();
HomeLocation::DataFields homeLocationData = homeLocation->getData();
// check if Homelocation is set

View File

@ -54,8 +54,8 @@ private:
// Milliseconds between automatic 'Instant Updates'
static const int AUTOMATIC_UPDATE_RATE = 500;
int m_pidBankCount;
int boardModel;
int m_pidBankCount;
int m_currentPIDBank;
protected:
QString mapObjectName(const QString objectName);

View File

@ -123,7 +123,6 @@ void FancyTabBar::mouseMoveEvent(QMouseEvent *e)
m_hoverRect = QRect();
if (m_hoverIndex >= 0) {
QRect oldHoverRect = m_hoverRect;
m_hoverRect = tabRect(m_hoverIndex);
m_hoverControl.start();
}

View File

@ -1756,7 +1756,7 @@ Setup the flight mode channel on the RC Input tab if you have not done so alread
</widget>
</item>
<item row="1" column="2" rowspan="2">
<widget class="QFrame" name="frame">
<widget class="QFrame" name="frame1">
<property name="minimumSize">
<size>
<width>120</width>

View File

@ -272,16 +272,6 @@
</spacer>
</item>
</layout>
<zorder>GenerateCurve</zorder>
<zorder>CurveSettings</zorder>
<zorder>CurveType</zorder>
<zorder>CurveMin</zorder>
<zorder>minLabel</zorder>
<zorder>CurveMax</zorder>
<zorder>maxLabel</zorder>
<zorder>CurveStep</zorder>
<zorder>stepLabel</zorder>
<zorder>verticalSpacer</zorder>
</widget>
</item>
<item row="0" column="1">

View File

@ -56,10 +56,10 @@ signals:
void channelChanged(int index, int value);
private:
Ui::outputChannelForm ui;
/// Channel index
int m_index;
bool m_inChannelTest;
Ui::outputChannelForm ui;
private slots:
void linkToggled(bool state);

View File

@ -495,7 +495,7 @@ margin:1px;</string>
</widget>
</item>
<item row="1" column="11">
<widget class="QFrame" name="frame">
<widget class="QFrame" name="frame_1">
<property name="minimumSize">
<size>
<width>45</width>

View File

@ -24133,7 +24133,7 @@ border-radius: 5;</string>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="gridGroupBox">
<widget class="QGroupBox" name="gridGroupBox_1">
<property name="title">
<string>Cruise Control</string>
</property>

View File

@ -105,6 +105,7 @@ void ConnectionManager::addWidget(QWidget *widget)
*/
bool ConnectionManager::connectDevice(DevListItem device)
{
Q_UNUSED(device);
QString deviceName = m_availableDevList->itemData(m_availableDevList->currentIndex(), Qt::ToolTipRole).toString();
DevListItem connection_device = findDevice(deviceName);

View File

@ -1110,7 +1110,7 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f) const
// Returns a mime type or Null one if none found
MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityPtr) const
{
typedef QList<MimeMapEntry> MimeMapEntryList;
typedef QList<MimeMapEntry> MimeMapEntryList __attribute__((unused));
// Is the hierarchy set up in case we find several matches?
if (m_maxLevel < 0) {

View File

@ -181,7 +181,7 @@ bool UAVConfigInfo::askToAbort(int compat, QString message)
msgBox.setInformativeText(tr("Do you want to continue the import?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
int result;
int result = QMessageBox::Abort;
switch (compat) {
case FullyCompatible:

View File

@ -43,6 +43,7 @@ QPointer<QTextBrowser> m_textedit;
void DebugGadgetWidget::customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
Q_UNUSED(context);
QString txt;
QColor color = Qt::black;

View File

@ -193,6 +193,102 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
setDisableControls(false);
}
void FlightLogManager::exportToOPL(QString fileName)
{
// Fix the file name
fileName.replace(QString(".opl"), QString("%1.opl"));
// Loop and create a new file for each flight.
int currentEntry = 0;
int currentFlight = 0;
quint32 adjustedBaseTime = 0;
// Continue until all entries are exported
while (currentEntry < m_logEntries.count()) {
if (m_adjustExportedTimestamps) {
adjustedBaseTime = m_logEntries[currentEntry]->getFlightTime();
}
// Get current flight
currentFlight = m_logEntries[currentEntry]->getFlight();
LogFile logFile;
logFile.useProvidedTimeStamp(true);
// Set the file name to contain flight number
logFile.setFileName(fileName.arg(tr("_flight-%1").arg(currentFlight + 1)));
logFile.open(QIODevice::WriteOnly);
UAVTalk uavTalk(&logFile, m_objectManager);
// Export entries until no more available or flight changes
while (currentEntry < m_logEntries.count() && m_logEntries[currentEntry]->getFlight() == currentFlight) {
ExtendedDebugLogEntry *entry = m_logEntries[currentEntry];
// Only log uavobjects
if (entry->getType() == ExtendedDebugLogEntry::TYPE_UAVOBJECT) {
// Set timestamp that should be logged for this entry
logFile.setNextTimeStamp(entry->getFlightTime() - adjustedBaseTime);
// Use UAVTalk to log complete message to file
uavTalk.sendObject(entry->uavObject(), false, false);
qDebug() << entry->getFlightTime() - adjustedBaseTime << "=" << entry->toStringBrief();
}
currentEntry++;
}
logFile.close();
}
}
void FlightLogManager::exportToCSV(QString fileName)
{
QFile csvFile(fileName);
if (csvFile.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream csvStream(&csvFile);
quint32 baseTime = 0;
quint32 currentFlight = 0;
csvStream << "Flight" << '\t' << "Flight Time" << '\t' << "Entry" << '\t' << "Data" << '\n';
foreach (ExtendedDebugLogEntry *entry , m_logEntries) {
if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) {
currentFlight = entry->getFlight();
baseTime = entry->getFlightTime();
}
entry->toCSV(&csvStream, baseTime);
}
csvStream.flush();
csvFile.flush();
csvFile.close();
}
}
void FlightLogManager::exportToXML(QString fileName)
{
QFile xmlFile(fileName);
if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) {
QXmlStreamWriter xmlWriter(&xmlFile);
xmlWriter.setAutoFormatting(true);
xmlWriter.setAutoFormattingIndent(4);
xmlWriter.writeStartDocument("1.0", true);
xmlWriter.writeStartElement("logs");
xmlWriter.writeComment("This file was created by the flight log export in OpenPilot GCS.");
quint32 baseTime = 0;
quint32 currentFlight = 0;
foreach (ExtendedDebugLogEntry *entry , m_logEntries) {
if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) {
currentFlight = entry->getFlight();
baseTime = entry->getFlightTime();
}
entry->toXML(&xmlWriter, baseTime);
}
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
xmlFile.flush();
xmlFile.close();
}
}
void FlightLogManager::exportLogs()
{
if (m_logEntries.isEmpty()) {
@ -202,49 +298,31 @@ void FlightLogManager::exportLogs()
setDisableControls(true);
QApplication::setOverrideCursor(Qt::WaitCursor);
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log"),
tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
tr("OpenPilot Log (*.opl)"));
QString oplFilter = tr("OpenPilot Log file %1").arg("(*.opl)");
QString csvFilter = tr("Text file %1").arg("(*.csv)");
QString xmlFilter = tr("XML file %1").arg("(*.xml)");
QString selectedFilter = csvFilter;
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Entries"),
QString("OP-%1").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
QString("%1;;%2;;%3").arg(oplFilter, csvFilter, xmlFilter), &selectedFilter);
if (!fileName.isEmpty()) {
// Loop and create a new file for each flight.
fileName = fileName.replace(QString(".opl"), QString("%1.opl"));
int currentEntry = 0;
int currentFlight = 0;
quint32 adjustedBaseTime = 0;
// Continue until all entries are exported
while (currentEntry < m_logEntries.count()) {
if (m_adjustExportedTimestamps) {
adjustedBaseTime = m_logEntries[currentEntry]->getFlightTime();
if (selectedFilter == oplFilter) {
if (!fileName.endsWith(".opl")) {
fileName.append(".opl");
}
// Get current flight
currentFlight = m_logEntries[currentEntry]->getFlight();
LogFile logFile;
logFile.useProvidedTimeStamp(true);
// Set the file name to contain flight number
logFile.setFileName(fileName.arg(tr("_flight-%1").arg(currentFlight + 1)));
logFile.open(QIODevice::WriteOnly);
UAVTalk uavTalk(&logFile, m_objectManager);
// Export entries until no more available or flight changes
while (currentEntry < m_logEntries.count() && m_logEntries[currentEntry]->getFlight() == currentFlight) {
ExtendedDebugLogEntry *entry = m_logEntries[currentEntry];
// Only log uavobjects
if (entry->getType() == ExtendedDebugLogEntry::TYPE_UAVOBJECT) {
// Set timestamp that should be logged for this entry
logFile.setNextTimeStamp(entry->getFlightTime() - adjustedBaseTime);
// Use UAVTalk to log complete message to file
uavTalk.sendObject(entry->uavObject(), false, false);
qDebug() << entry->getFlightTime() - adjustedBaseTime << "=" << entry->toStringBrief();
}
currentEntry++;
exportToOPL(fileName);
} else if (selectedFilter == csvFilter) {
if (!fileName.endsWith(".csv")) {
fileName.append(".csv");
}
logFile.close();
exportToCSV(fileName);
} else if (selectedFilter == xmlFilter) {
if (!fileName.endsWith(".xml")) {
fileName.append(".xml");
}
exportToXML(fileName);
}
}
@ -297,6 +375,33 @@ QString ExtendedDebugLogEntry::getLogString()
}
}
void ExtendedDebugLogEntry::toXML(QXmlStreamWriter *xmlWriter, quint32 baseTime)
{
xmlWriter->writeStartElement("entry");
xmlWriter->writeAttribute("flight", QString::number(getFlight() + 1));
xmlWriter->writeAttribute("flighttime", QString::number(getFlightTime() - baseTime));
xmlWriter->writeAttribute("entry", QString::number(getEntry()));
if (getType() == DebugLogEntry::TYPE_TEXT) {
xmlWriter->writeAttribute("type", "text");
xmlWriter->writeTextElement("message", QString((const char *)getData().Data));
} else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) {
xmlWriter->writeAttribute("type", "uavobject");
m_object->toXML(xmlWriter);
}
xmlWriter->writeEndElement(); //entry
}
void ExtendedDebugLogEntry::toCSV(QTextStream *csvStream, quint32 baseTime)
{
QString data;
if (getType() == DebugLogEntry::TYPE_TEXT) {
data = QString((const char *)getData().Data);
} else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) {
data = m_object->toString().replace("\n", "").replace("\t", "");
}
*csvStream << QString::number(getFlight() + 1) << '\t' << QString::number(getFlightTime() - baseTime) << '\t' << QString::number(getEntry()) << '\t' << data << '\n';
}
void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVObjectManager *objectManager)
{
DebugLogEntry::setData(data);

View File

@ -32,6 +32,8 @@
#include <QList>
#include <QQmlListProperty>
#include <QSemaphore>
#include <QXmlStreamWriter>
#include <QTextStream>
#include "uavobjectmanager.h"
#include "debuglogentry.h"
@ -46,6 +48,8 @@ public:
~ExtendedDebugLogEntry();
QString getLogString();
void toXML(QXmlStreamWriter *xmlWriter, quint32 baseTime);
void toCSV(QTextStream *csvStream, quint32 baseTime);
UAVDataObject *uavObject()
{
return m_object;
@ -157,6 +161,11 @@ private:
bool m_disableExport;
bool m_cancelDownload;
bool m_adjustExportedTimestamps;
void exportToOPL(QString fileName);
void exportToCSV(QString fileName);
void exportToXML(QString fileName);
};
#endif // FLIGHTLOGMANAGER_H

View File

@ -146,10 +146,10 @@ void GCSControlGadget::sticksChangedLocally(double leftX, double leftY, double r
double oldYaw = manualControlCommand->getField("Yaw")->getDouble();
double oldThrottle = manualControlCommand->getField("Throttle")->getDouble();
double newRoll;
double newPitch;
double newYaw;
double newThrottle;
double newRoll = 0.0;
double newPitch = 0.0;
double newYaw = 0.0;
double newThrottle = 0.0;
// Remap left X/Y and right X/Y to RPYT depending on mode
switch (controlsMode) {
@ -248,7 +248,10 @@ void GCSControlGadget::gamepads(quint8 count)
void GCSControlGadget::readUDPCommand()
{
double pitch, yaw, roll, throttle;
double pitch = 0.0;
double yaw = 0.0;
double roll = 0.0;
double throttle = 0.0;
while (control_sock->hasPendingDatagrams()) {
QByteArray datagram;

View File

@ -247,15 +247,15 @@ void FGSimulator::processUpdate(const QByteArray & inp)
// Get rollRate (deg/s)
float rollRate = fields[9].toFloat();
// Get yaw (deg)
float yaw = fields[10].toFloat();
float yaw = fields[10].toFloat();
// Get yawRate (deg/s)
float yawRate = fields[11].toFloat();
float yawRate = fields[11].toFloat();
// Get latitude (deg)
float latitude = fields[12].toFloat();
float latitude = fields[12].toFloat();
// Get longitude (deg)
float longitude = fields[13].toFloat();
float longitude = fields[13].toFloat();
// Get heading (deg)
float heading = fields[14].toFloat();
// float heading = fields[14].toFloat();
// Get altitude (m)
float altitude_msl = fields[15].toFloat() * FT2M;
// Get altitudeAGL (m)

View File

@ -410,14 +410,10 @@ void Simulator::updateUAVOs(Output2Hardware out)
homeData.Latitude = out.latitude; // Already in *10^7 integer format
homeData.Longitude = out.longitude; // Already in *10^7 integer format
homeData.Altitude = out.agl;
double LLA[3];
LLA[0] = out.latitude;
LLA[1] = out.longitude;
LLA[2] = out.altitude;
homeData.Be[0] = 0;
homeData.Be[1] = 0;
homeData.Be[2] = 0;
homeData.Be[0] = 0;
homeData.Be[1] = 0;
homeData.Be[2] = 0;
posHome->setData(homeData);
posHome->updated();
@ -498,13 +494,13 @@ void Simulator::updateUAVOs(Output2Hardware out)
AttitudeSettings::DataFields attSettData = attSettings->getData();
float accelKp = attSettData.AccelKp * 0.1666666666666667;
float accelKi = attSettData.AccelKp * 0.1666666666666667;
// float accelKi = attSettData.AccelKp * 0.1666666666666667;
float yawBiasRate = attSettData.YawBiasRate;
// calibrate sensors on arming
if (flightStatus->getData().Armed == FlightStatus::ARMED_ARMING) {
accelKp = 2.0;
accelKi = 0.9;
// accelKi = 0.9;
}
float gyro[3] = { out.rollRate, out.pitchRate, out.yawRate };

View File

@ -176,11 +176,9 @@ private:
double yellowMax;
double greenMin;
double greenMax;
double factor;
bool useOpenGLFlag;
int decimalPlaces;
bool useOpenGLFlag;
};
#endif // LINEARDIALGADGETCONFIGURATION_H

View File

@ -78,7 +78,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QHBoxLayout" name="horizontalLayout_66">
<property name="topMargin">
<number>0</number>
</property>

View File

@ -42,4 +42,6 @@ LoggingGadget::~LoggingGadget()
}
void LoggingGadget::loadConfiguration(IUAVGadgetConfiguration *config)
{}
{
Q_UNUSED(config);
}

View File

@ -48,9 +48,8 @@ PositionField::PositionField(QWidget *parent) :
setScene(new QGraphicsScene(this));
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
m_renderer = new QSvgRenderer();
bool success = m_renderer->load(QString(":/magicwaypoint/images/positionfield.svg"));
Q_ASSERT(success);
m_renderer = new QSvgRenderer();
m_renderer->load(QString(":/magicwaypoint/images/positionfield.svg"));
m_background = new QGraphicsSvgItem();
m_background->setSharedRenderer(m_renderer);

View File

@ -46,9 +46,9 @@ QStringList NotificationItem::retryValues;
NotificationItem::NotificationItem(QObject *parent)
: QObject(parent)
, _currentUpdatePlayed(false)
, isNowPlaying(0)
, _isPlayed(false)
, _currentUpdatePlayed(false)
, _timer(NULL)
, _expireTimer(NULL)
, _soundCollectionPath("")

View File

@ -144,6 +144,7 @@ void NotifyItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model
void NotifyItemDelegate::selectRow(const QString & text)
{
Q_UNUSED(text);
QComboBox *combo = qobject_cast<QComboBox *>(sender());
QTableWidget *table = new QTableWidget;

View File

@ -351,13 +351,6 @@ void SoundNotifyPlugin::stateChanged(QMediaPlayer::State newstate)
playNotification(notification);
qNotifyDebug() << "end playNotification";
}
} else {
if (newstate == QMediaPlayer::ServiceMissingError) {
if (phonon.mo->error() == 0) {
qDebug() << "Phonon::ErrorState: ErrorType = " << phonon.mo->error();
phonon.mo->stop();
}
}
}
}

View File

@ -640,7 +640,8 @@ void NotifyPluginOptionsPage::on_FinishedPlaying()
void NotifyPluginOptionsPage::on_toggled_checkEnableSound(bool state)
{
bool state1 = 1 ^ state;
Q_UNUSED(state);
// bool state1 = 1 ^ state;
// QList<Phonon::Path> listOutputs = _testSound->outputPaths();
// Phonon::AudioOutput *audioOutput = (Phonon::AudioOutput *)listOutputs.last().sink();

View File

@ -186,6 +186,7 @@ QStringList NotifyTableModel::mimeTypes() const
bool NotifyTableModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row,
int column, const QModelIndex & parent)
{
Q_UNUSED(column);
if (action == Qt::IgnoreAction) {
return true;
}
@ -233,11 +234,9 @@ bool NotifyTableModel::dropMimeData(const QMimeData *data, Qt::DropAction action
continue;
}
bool success = insertRows(rows + direction, 1, QModelIndex());
Q_ASSERT(success);
insertRows(rows + direction, 1, QModelIndex());
_list.replace(rows + direction, item);
success = removeRows(dragged, 1, QModelIndex());
Q_ASSERT(success);
removeRows(dragged, 1, QModelIndex());
if (direction == UP_DIRECTION) {
++rows;
}

View File

@ -45,6 +45,7 @@ public:
NotifyTableModel(QList<NotificationItem *> & parentList, QObject *parent = 0);
int rowCount(const QModelIndex & parent = QModelIndex()) const
{
Q_UNUSED(parent);
return _list.count();
}

View File

@ -1205,9 +1205,9 @@ int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index
}
HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev __attribute__ ((unused)))
{
return NULL;
return NULL;
}

View File

@ -92,19 +92,14 @@ modelMapProxy::overlayType modelMapProxy::overlayTranslate(int type)
case MapDataDelegate::MODE_DRIVEVECTOR:
return OVERLAY_LINE;
break;
case MapDataDelegate::MODE_FLYCIRCLERIGHT:
case MapDataDelegate::MODE_DRIVECIRCLERIGHT:
return OVERLAY_CIRCLE_RIGHT;
break;
case MapDataDelegate::MODE_FLYCIRCLELEFT:
case MapDataDelegate::MODE_DRIVECIRCLELEFT:
return OVERLAY_CIRCLE_LEFT;
break;
default:
break;
return OVERLAY_CIRCLE_LEFT;
}
}
@ -297,7 +292,11 @@ void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &b
void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last)
{
Q_UNUSED(parent);
for (int x = first; x < last + 1; x++) {
Q_UNUSED(first);
Q_UNUSED(last);
/*
for (int x = first; x < last + 1; x++) {
QModelIndex index;
WayPointItem *item;
internals::PointLatLng latlng;
@ -325,7 +324,8 @@ void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last)
} else {
item = myMap->WPInsert(latlng, altitude, desc, x);
}
}
}
*/
refreshOverlays();
}
void modelMapProxy::deleteWayPoint(int number)

View File

@ -51,10 +51,10 @@ public:
void editWaypoint(mapcontrol::WayPointItem *waypoint_item);
private:
Ui::opmap_edit_waypoint_dialog *ui;
QDataWidgetMapper *mapper;
QAbstractItemModel *model;
QItemSelectionModel *itemSelection;
Ui::opmap_edit_waypoint_dialog *ui;
private slots:
private slots:

View File

@ -490,13 +490,6 @@
</spacer>
</item>
</layout>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
<zorder></zorder>
<zorder>verticalSpacer</zorder>
<zorder>line</zorder>
<zorder>label_7</zorder>
</widget>
</widget>
</item>

View File

@ -153,7 +153,7 @@ void PathActionEditorTreeModel::addSingleField(int index, UAVObjectField *field,
data.append(QString("[%1]").arg((field->getElementNames())[index]));
}
FieldTreeItem *item;
FieldTreeItem *item = NULL;
UAVObjectField::FieldType type = field->getType();
// hack: list available actions in an enum
if (field->getName().compare("Action") == 0 && type == UAVObjectField::UINT8) {
@ -423,8 +423,9 @@ void PathActionEditorTreeModel::newInstance(UAVObject *obj)
void PathActionEditorTreeModel::objUpdated(UAVObject *obj)
{
quint16 index = m_objManager->getObject("WaypointActive")->getField("Index")->getValue().toInt();
quint16 action;
Q_UNUSED(obj);
quint16 index = m_objManager->getObject("WaypointActive")->getField("Index")->getValue().toInt();
quint16 action = 0;
foreach(TreeItem * child, m_waypointsTree->treeChildren()) {
ObjectTreeItem *objItem = dynamic_cast<ObjectTreeItem *>(child);

View File

@ -108,6 +108,7 @@ void TreeItem::apply()
void TreeItem::setHighlight(bool highlight)
{
Q_UNUSED(highlight)
// m_highlight = highlight;
m_changed = false;
}

View File

@ -162,6 +162,7 @@ void PfdQmlGadgetWidget::setAltitudeFactor(double factor)
void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg)
{
Q_UNUSED(arg);
setTerrainEnabled(m_terrainEnabled);
}

View File

@ -155,7 +155,8 @@ void ConnectionDiagram::setupGraphicsScene()
void ConnectionDiagram::setupGraphicsSceneItems(QList<QString> elementsToShow)
{
qreal z = 0;
QRectF backgBounds = m_renderer->boundsOnElement("background");
// QRectF backgBounds = m_renderer->boundsOnElement("background");
foreach(QString elementId, elementsToShow) {
if (m_renderer->elementExists(elementId)) {

View File

@ -398,10 +398,9 @@ void VehicleConfigurationHelper::applySensorBiasConfiguration()
void VehicleConfigurationHelper::applyStabilizationConfiguration()
{
StabilizationSettings *stabSettings = StabilizationSettings::GetInstance(m_uavoManager);
StabilizationSettings *stabSettings = StabilizationSettings::GetInstance(m_uavoManager);
Q_ASSERT(stabSettings);
StabilizationSettings::DataFields data = stabSettings->getData();
StabilizationSettings defaultSettings;
stabSettings->setData(defaultSettings.getData());
@ -715,11 +714,6 @@ GUIConfigDataUnion VehicleConfigurationHelper::getGUIConfigData()
{
GUIConfigDataUnion configData;
SystemSettings *systemSettings = SystemSettings::GetInstance(m_uavoManager);
Q_ASSERT(systemSettings);
SystemSettings::DataFields systemSettingsData = systemSettings->getData();
for (int i = 0; i < (int)(SystemSettings::GUICONFIGDATA_NUMELEM); i++) {
configData.UAVObject[i] = 0; // systemSettingsData.GUIConfigData[i];
}
@ -731,7 +725,7 @@ void VehicleConfigurationHelper::setupQuadCopter()
{
mixerChannelSettings channels[10];
GUIConfigDataUnion guiSettings = getGUIConfigData();
SystemSettings::AirframeTypeOptions frame;
SystemSettings::AirframeTypeOptions frame = SystemSettings::AIRFRAMETYPE_QUADX;
switch (m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS:
@ -821,7 +815,7 @@ void VehicleConfigurationHelper::setupHexaCopter()
{
mixerChannelSettings channels[10];
GUIConfigDataUnion guiSettings = getGUIConfigData();
SystemSettings::AirframeTypeOptions frame;
SystemSettings::AirframeTypeOptions frame = SystemSettings::AIRFRAMETYPE_HEXA;
switch (m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::MULTI_ROTOR_HEXA:
@ -1000,7 +994,7 @@ void VehicleConfigurationHelper::setupOctoCopter()
{
mixerChannelSettings channels[10];
GUIConfigDataUnion guiSettings = getGUIConfigData();
SystemSettings::AirframeTypeOptions frame;
SystemSettings::AirframeTypeOptions frame = SystemSettings::AIRFRAMETYPE_OCTO;
switch (m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::MULTI_ROTOR_OCTO:

View File

@ -46,6 +46,7 @@ MonitorGadget::~MonitorGadget()
*/
void MonitorGadget::loadConfiguration(IUAVGadgetConfiguration *config)
{
Q_UNUSED(config);
// MonitorGadgetConfiguration *m = qobject_cast<MonitorGadgetConfiguration *>(config);
// m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint

View File

@ -47,6 +47,7 @@ IUAVGadgetConfiguration *MonitorGadgetConfiguration::clone()
*/
void MonitorGadgetConfiguration::saveConfig(QSettings *qSettings) const
{
Q_UNUSED(qSettings);
// qSettings->setValue("acFilename", Utils::PathUtils().RemoveDataPath(m_acFilename));
// qSettings->setValue("bgFilename", Utils::PathUtils().RemoveDataPath(m_bgFilename));
// qSettings->setValue("enableVbo", m_enableVbo);

View File

@ -81,5 +81,6 @@ IUAVGadgetConfiguration *MonitorGadgetFactory::createConfiguration(QSettings *qS
IOptionsPage *MonitorGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
{
Q_UNUSED(config);
return 0; // new MonitorGadgetOptionsPage(qobject_cast<MonitorGadgetConfiguration *>(config));
}

View File

@ -32,7 +32,9 @@
MonitorGadgetOptionsPage::MonitorGadgetOptionsPage(MonitorGadgetConfiguration *config, QObject *parent)
: IOptionsPage(parent)
{}
{
Q_UNUSED(config);
}
MonitorGadgetOptionsPage::~MonitorGadgetOptionsPage()
{}

View File

@ -111,8 +111,8 @@ public slots:
private:
QColor m_recentlyUpdatedColor;
QColor m_manuallyChangedColor;
int m_recentlyUpdatedTimeout;
bool m_onlyHilightChangedValues;
int m_recentlyUpdatedTimeout;
bool m_useCategorizedView;
bool m_useScientificView;
bool m_showMetaData;

View File

@ -94,13 +94,8 @@ void UAVObjectBrowserWidget::showMetaData(bool show)
void UAVObjectBrowserWidget::categorize(bool categorize)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
Q_ASSERT(objManager);
UAVObjectTreeModel *tmpModel = m_model;
m_model = new UAVObjectTreeModel(0, categorize, m_viewoptions->cbScientific->isChecked());
m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor);
m_model->setManuallyChangedColor(m_manuallyChangedColor);
@ -115,13 +110,8 @@ void UAVObjectBrowserWidget::categorize(bool categorize)
void UAVObjectBrowserWidget::useScientificNotation(bool scientific)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
Q_ASSERT(objManager);
UAVObjectTreeModel *tmpModel = m_model;
m_model = new UAVObjectTreeModel(0, m_viewoptions->cbCategorized->isChecked(), scientific);
m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor);
m_model->setManuallyChangedColor(m_manuallyChangedColor);

View File

@ -207,7 +207,7 @@ void UAVObjectTreeModel::addSingleField(int index, UAVObjectField *field, TreeIt
data.append(QString("[%1]").arg((field->getElementNames())[index]));
}
FieldTreeItem *item;
FieldTreeItem *item = NULL;
UAVObjectField::FieldType type = field->getType();
switch (type) {
case UAVObjectField::BITFIELD:

View File

@ -110,12 +110,12 @@ private:
TreeItem *m_rootItem;
TopTreeItem *m_settingsTree;
TopTreeItem *m_nonSettingsTree;
bool m_useScientificFloatNotation;
bool m_categorize;
int m_recentlyUpdatedTimeout;
QColor m_recentlyUpdatedColor;
QColor m_manuallyChangedColor;
bool m_onlyHilightChangedValues;
bool m_useScientificFloatNotation;
bool m_categorize;
// Highlight manager to handle highlighting of tree items.
HighLightManager *m_highlightManager;

View File

@ -519,6 +519,19 @@ QString UAVObject::toStringData()
return sout;
}
void UAVObject::toXML(QXmlStreamWriter *xmlWriter)
{
xmlWriter->writeStartElement("object");
xmlWriter->writeAttribute("name", getName());
xmlWriter->writeAttribute("id", QString("%1-%2").arg(getObjID(), 1, 16).toUpper().arg(getInstID()));
xmlWriter->writeStartElement("fields");
foreach(UAVObjectField* field , fields) {
field->toXML(xmlWriter);
}
xmlWriter->writeEndElement(); // fields
xmlWriter->writeEndElement(); // object
}
/**
* Emit the transactionCompleted event (used by the UAVTalk plugin)
*/

View File

@ -37,6 +37,7 @@
#include <QList>
#include <QFile>
#include <stdint.h>
#include <QXmlStreamWriter>
#include "uavobjectfield.h"
#define UAVOBJ_ACCESS_SHIFT 0
@ -127,6 +128,7 @@ public:
QString toString();
QString toStringBrief();
QString toStringData();
void toXML(QXmlStreamWriter *xmlWriter);
void emitTransactionCompleted(bool success);
void emitNewInstance(UAVObject *);

View File

@ -654,6 +654,24 @@ QString UAVObjectField::toString()
return sout;
}
void UAVObjectField::toXML(QXmlStreamWriter *xmlWriter)
{
xmlWriter->writeStartElement("field");
xmlWriter->writeAttribute("name", getName());
xmlWriter->writeAttribute("type", getTypeAsString());
if (!getUnits().isEmpty()) {
xmlWriter->writeAttribute("unit", getUnits());
}
for (unsigned int n = 0; n < numElements; ++n) {
xmlWriter->writeStartElement("value");
if(getElementNames().size() > 1) {
xmlWriter->writeAttribute("name", getElementNames().at(n));
}
xmlWriter->writeCharacters(getValue(n).toString());
xmlWriter->writeEndElement(); // value
}
xmlWriter->writeEndElement(); // field
}
qint32 UAVObjectField::pack(quint8 *dataOut)
{

View File

@ -34,6 +34,7 @@
#include <QVariant>
#include <QList>
#include <QMap>
#include <QXmlStreamWriter>
class UAVObject;
@ -72,6 +73,7 @@ public:
bool isNumeric();
bool isText();
QString toString();
void toXML(QXmlStreamWriter *xmlWriter);
bool isWithinLimits(QVariant var, quint32 index, int board = 0);
QVariant getMaxLimit(quint32 index, int board = 0);

View File

@ -316,12 +316,11 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard)
{
double Be[3];
int result = Utils::HomeLocationUtil().getDetails(LLA, Be);
Q_ASSERT(result == 0);
Utils::HomeLocationUtil().getDetails(LLA, Be);
// save the new settings
HomeLocation *homeLocation = HomeLocation::GetInstance(obm);
Q_ASSERT(homeLocation != NULL);
HomeLocation::DataFields homeLocationData = homeLocation->getData();

View File

@ -404,7 +404,7 @@ void ConfigTaskWidget::widgetsContentsChanged()
{
QWidget *emitter = ((QWidget *)sender());
emit widgetContentsChanged(emitter);
double scale;
double scale = 1.0;
QVariant value;
foreach(WidgetBinding * binding, m_widgetBindingsPerWidget.values(emitter)) {

View File

@ -64,7 +64,7 @@ public:
uint32_t TxError;
uint16_t flags;
port(QString name);
~port();
virtual ~port();
portstatus status();
private:
portstatus mstatus;

View File

@ -47,8 +47,8 @@ private:
QQueue<QByteArray> queue;
QMutex mutex;
QMutex sendbufmutex;
bool datapending;
bool endthread;
bool datapending;
uint16_t sendstatus;
uint16_t receivestatus;
QWaitCondition sendwait;

View File

@ -225,6 +225,7 @@ void DeviceWidget::dfuStatus(QString str)
void DeviceWidget::confirmCB(int value)
{
Q_UNUSED(value);
updateButtons(true);
}
@ -277,7 +278,7 @@ void DeviceWidget::loadFirmware()
QByteArray desc = loadedFW.right(100);
QPixmap px;
if (loadedFW.length() > m_dfu->devices[deviceID].SizeOfCode) {
if (loadedFW.length() > (int)m_dfu->devices[deviceID].SizeOfCode) {
myDevice->lblCRCL->setText(tr("Can't calculate, file too big for device"));
} else {
myDevice->lblCRCL->setText(QString::number(DFUObject::CRCFromQBArray(loadedFW, m_dfu->devices[deviceID].SizeOfCode)));

View File

@ -246,7 +246,7 @@ bool DFUObject::UploadData(qint32 const & numberOfBytes, QByteArray & data)
buf[1] = OP_DFU::Upload; // DFU Command
int packetsize;
float percentage;
int laspercentage;
int laspercentage = 0;
for (qint32 packetcount = 0; packetcount < numberOfPackets; ++packetcount) {
percentage = (float)(packetcount + 1) / numberOfPackets * 100;
if (laspercentage != (int)percentage) {
@ -433,7 +433,7 @@ bool DFUObject::StartDownloadT(QByteArray *fw, qint32 const & numberOfBytes, Tra
qDebug() << "StartDownload:" << numberOfPackets << "packets" << " Last Packet Size=" << lastPacketCount << " " << result << " bytes sent";
}
float percentage;
int laspercentage;
int laspercentage = 0;
// Now get those packets:
for (qint32 x = 0; x < numberOfPackets; ++x) {
@ -637,8 +637,8 @@ bool DFUObject::findDevices()
buf[7] = 0;
buf[8] = 0;
buf[9] = 0;
int result = sendData(buf, BUF_LEN);
result = receiveData(buf, BUF_LEN);
sendData(buf, BUF_LEN);
receiveData(buf, BUF_LEN);
devices[x].ID = buf[14];
devices[x].ID = devices[x].ID << 8 | (quint8)buf[15];
devices[x].BL_Version = buf[7];
@ -749,7 +749,7 @@ OP_DFU::Status DFUObject::UploadFirmwareT(const QString &sfile, const bool &veri
pad = pad - arr.length();
arr.append(QByteArray(pad, 255));
}
if (devices[device].SizeOfCode < arr.length()) {
if (devices[device].SizeOfCode < (quint32)arr.length()) {
if (debug) {
qDebug() << "ERROR file to big for device";
}

View File

@ -115,7 +115,7 @@ public:
// DFUObject(bool debug);
DFUObject(bool debug, bool use_serial, QString port);
~DFUObject();
virtual ~DFUObject();
// Service commands:
bool enterDFU(int const &devNumber);

View File

@ -11,6 +11,10 @@ macx {
QMAKE_CXXFLAGS += -fpermissive
}
!macx {
QMAKE_CXXFLAGS += -Wno-enum-compare
}
HEADERS += uploadergadget.h \
uploadergadgetconfiguration.h \
uploadergadgetfactory.h \