diff --git a/images/earth.html b/images/earth.html
index c5699c596d2fdf2eff7948b77dc4780c19abaad8..2f6a70aa8bb20691d6848210c230fc323f4e1d33 100644
--- a/images/earth.html
+++ b/images/earth.html
@@ -177,7 +177,7 @@ trailsVisible[id] = false;
}
-function hideTrail(id)
+function clearTrail(id)
{
trailsVisible[id] = false;
ge.getFeatures().removeChild(trailPlacemarks[id]);
@@ -253,9 +253,9 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
// FIXME Currently invalid conversion from right-handed z-down to z-up frame
planeOrient.setRoll(((roll/M_PI))*180.0+180.0);
planeOrient.setTilt(((pitch/M_PI))*180.0+180.0);
- planeOrient.setHeading(((yaw/M_PI))*180.0-90.0);
+ planeOrient.setHeading(((yaw/M_PI))*180.0-90.0+180.0);
- currFollowHeading = ((yaw/M_PI))*180.0;
+ currFollowHeading = ((yaw/M_PI))*180.0+180.0;
planeLoc.setLatitude(lastLat);
planeLoc.setLongitude(lastLon);
diff --git a/src/QGC.cc b/src/QGC.cc
index 087c4885742a48ca3efdc1ad61705f1ea64e4701..04735eb1f3df10553f6646efe151b66a08bc55b7 100644
--- a/src/QGC.cc
+++ b/src/QGC.cc
@@ -23,6 +23,8 @@ This file is part of the QGROUNDCONTROL project
#include "QGC.h"
+#include
+
namespace QGC {
quint64 groundTimeUsecs()
@@ -34,6 +36,25 @@ quint64 groundTimeUsecs()
return static_cast(microseconds + (time.time().msec()*1000));
}
+double limitAngleToPMPI(double angle)
+{
+ if (angle < -M_PI)
+ {
+ while (angle < -M_PI)
+ {
+ angle += M_PI;
+ }
+ }
+ else if (angle > M_PI)
+ {
+ while (angle > M_PI)
+ {
+ angle -= M_PI;
+ }
+ }
+ return angle;
+}
+
int applicationVersion()
{
return APPLICATIONVERSION;
diff --git a/src/QGC.h b/src/QGC.h
index 7ece2f230415217e17e70a65c24c0907801315ed..b777115a92c845a5e58939bd5bc90ba03041ca6b 100644
--- a/src/QGC.h
+++ b/src/QGC.h
@@ -18,6 +18,8 @@ namespace QGC
/** @brief Get the current ground time in microseconds */
quint64 groundTimeUsecs();
+ /** @brief Returns the angle limited to -pi - pi */
+ double limitAngleToPMPI(double angle);
int applicationVersion();
const static int MAX_FLIGHT_TIME = 60 * 60 * 24 * 21;
diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc
index 57ac970bb25f97bb66849b72fdc0fca32008dafa..32c9b500585613f1ab7c07eedf20f43b24f8b779 100644
--- a/src/comm/MAVLinkProtocol.cc
+++ b/src/comm/MAVLinkProtocol.cc
@@ -77,10 +77,7 @@ MAVLinkProtocol::~MAVLinkProtocol()
void MAVLinkProtocol::run()
{
- forever
- {
- QGC::SLEEP::msleep(5000);
- }
+ exec();
}
QString MAVLinkProtocol::getLogfileName()
diff --git a/src/comm/MAVLinkSimulationLink.cc b/src/comm/MAVLinkSimulationLink.cc
index 6524f46d17508c5b446e197a05b61ac7dae953df..0eb07475bc519fd7251697d35f63d4ac8a89b1cd 100644
--- a/src/comm/MAVLinkSimulationLink.cc
+++ b/src/comm/MAVLinkSimulationLink.cc
@@ -959,6 +959,7 @@ bool MAVLinkSimulationLink::connect()
MAVLinkSimulationMAV* mav1 = new MAVLinkSimulationMAV(this, 1, 47.376, 8.548);
MAVLinkSimulationMAV* mav2 = new MAVLinkSimulationMAV(this, 2);
Q_UNUSED(mav1);
+ Q_UNUSED(mav2);
// timer->start(rate);
return true;
}
diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc
index 088487043e019aa61bce853efa5d9a8852b112b5..3c3240498e88aa37973cc056e29043c12805e7f5 100644
--- a/src/comm/UDPLink.cc
+++ b/src/comm/UDPLink.cc
@@ -64,10 +64,11 @@ UDPLink::~UDPLink()
**/
void UDPLink::run()
{
- forever
- {
- QGC::SLEEP::msleep(5000);
- }
+// forever
+// {
+// QGC::SLEEP::msleep(5000);
+// }
+ exec();
}
void UDPLink::setAddress(QString address)
diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc
index dde06f5391bd68b447821e1a0971113839e9ff70..6f79c3b84d613cf676bb5a1de1f405bb0012e5f1 100644
--- a/src/uas/UAS.cc
+++ b/src/uas/UAS.cc
@@ -385,6 +385,11 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
roll = attitude.roll;
pitch = attitude.pitch;
yaw = attitude.yaw;
+
+ roll = QGC::limitAngleToPMPI(roll);
+ pitch = QGC::limitAngleToPMPI(pitch);
+ yaw = QGC::limitAngleToPMPI(yaw);
+
// emit valueChanged(uasId, "roll IMU", mavlink_msg_attitude_get_roll(&message), time);
// emit valueChanged(uasId, "pitch IMU", mavlink_msg_attitude_get_pitch(&message), time);
// emit valueChanged(uasId, "yaw IMU", mavlink_msg_attitude_get_yaw(&message), time);
diff --git a/src/uas/UASManager.cc b/src/uas/UASManager.cc
index c59f50ada8e203b390bccbb0b597efca4d2f726b..d7539a9cf864cd58581faa2d919cfe9232e05f85 100644
--- a/src/uas/UASManager.cc
+++ b/src/uas/UASManager.cc
@@ -69,10 +69,11 @@ UASManager::~UASManager()
void UASManager::run()
{
- forever
- {
- QGC::SLEEP::msleep(5000);
- }
+// forever
+// {
+// QGC::SLEEP::msleep(5000);
+// }
+ exec();
}
void UASManager::addUAS(UASInterface* uas)
diff --git a/src/ui/DebugConsole.cc b/src/ui/DebugConsole.cc
index e6ee4e188c156608cd37cf269ba0a28dacb11f4d..82989b19cef3ec8b2114c21873a030be3a9505f8 100644
--- a/src/ui/DebugConsole.cc
+++ b/src/ui/DebugConsole.cc
@@ -29,6 +29,7 @@ This file is part of the QGROUNDCONTROL project
*
*/
#include
+#include
#include "DebugConsole.h"
#include "ui_DebugConsole.h"
@@ -45,6 +46,7 @@ DebugConsole::DebugConsole(QWidget *parent) :
holdOn(false),
convertToAscii(true),
filterMAVLINK(false),
+ autoHold(true),
bytesToIgnore(0),
lastByte(-1),
sentBytes(),
@@ -57,7 +59,6 @@ DebugConsole::DebugConsole(QWidget *parent) :
dataRate(0.0f),
lowpassDataRate(0.0f),
dataRateThreshold(500),
- autoHold(true),
commandIndex(0),
m_ui(new Ui::DebugConsole)
{
@@ -121,14 +122,57 @@ DebugConsole::DebugConsole(QWidget *parent) :
hold(false);
- this->setVisible(false);
+ loadSettings();
+
+ // Warn user about not activated hold
+ if (!m_ui->holdCheckBox->isChecked())
+ {
+ m_ui->receiveText->appendHtml(QString("%2\n").arg(QColor(Qt::red).name(), tr("WARNING: You have NOT enabled auto-hold (stops updating the console is huge amounts of serial data arrive). Updating the console consumes significant CPU load, so if you receive more than about 5 KB/s of serial data, make sure to enable auto-hold if not using the console.")));
+ }
}
DebugConsole::~DebugConsole()
{
+ storeSettings();
delete m_ui;
}
+void DebugConsole::loadSettings()
+{
+ // Load defaults from settings
+ QSettings settings;
+ settings.sync();
+ settings.beginGroup("QGC_DEBUG_CONSOLE");
+ m_ui->specialComboBox->setCurrentIndex(settings.value("SPECIAL_SYMBOL", m_ui->specialComboBox->currentIndex()).toInt());
+ m_ui->specialCheckBox->setChecked(settings.value("SPECIAL_SYMBOL_CHECKBOX_STATE", m_ui->specialCheckBox->isChecked()).toBool());
+ hexModeEnabled(settings.value("HEX_MODE_ENABLED", m_ui->hexCheckBox->isChecked()).toBool());
+ MAVLINKfilterEnabled(settings.value("MAVLINK_FILTER_ENABLED", m_ui->mavlinkCheckBox->isChecked()).toBool());
+ setAutoHold(settings.value("AUTO_HOLD_ENABLED", m_ui->holdCheckBox->isChecked()).toBool());
+ settings.endGroup();
+
+ // Update visibility settings
+ if (m_ui->specialCheckBox->isChecked())
+ {
+ m_ui->specialCheckBox->setVisible(true);
+ m_ui->addSymbolButton->setVisible(false);
+ }
+}
+
+void DebugConsole::storeSettings()
+{
+ // Store settings
+ QSettings settings;
+ settings.beginGroup("QGC_DEBUG_CONSOLE");
+ settings.setValue("SPECIAL_SYMBOL", m_ui->specialComboBox->currentIndex());
+ settings.setValue("SPECIAL_SYMBOL_CHECKBOX_STATE", m_ui->specialCheckBox->isChecked());
+ settings.setValue("HEX_MODE_ENABLED", m_ui->hexCheckBox->isChecked());
+ settings.setValue("MAVLINK_FILTER_ENABLED", m_ui->mavlinkCheckBox->isChecked());
+ settings.setValue("AUTO_HOLD_ENABLED", m_ui->holdCheckBox->isChecked());
+ settings.endGroup();
+ settings.sync();
+ //qDebug() << "Storing settings!";
+}
+
/**
* Add a link to the debug console output
*/
@@ -480,6 +524,12 @@ void DebugConsole::appendSpecialSymbol()
void DebugConsole::sendBytes()
{
+ // FIXME This store settings should be removed
+ // once all threading issues have been resolved
+ // since its called in the destructor, which
+ // is absolutely sufficient
+ storeSettings();
+
// Store command history
commandHistory.append(m_ui->sendText->text());
// Since text was just sent, we're at position commandHistory.length()
@@ -614,11 +664,18 @@ void DebugConsole::sendBytes()
*/
void DebugConsole::hexModeEnabled(bool mode)
{
- convertToAscii = !mode;
- m_ui->receiveText->clear();
- m_ui->sendText->clear();
- m_ui->sentText->clear();
- commandHistory.clear();
+ if (convertToAscii == mode)
+ {
+ convertToAscii = !mode;
+ if (m_ui->hexCheckBox->isChecked() != mode)
+ {
+ m_ui->hexCheckBox->setChecked(mode);
+ }
+ m_ui->receiveText->clear();
+ m_ui->sendText->clear();
+ m_ui->sentText->clear();
+ commandHistory.clear();
+ }
}
/**
@@ -626,14 +683,23 @@ void DebugConsole::hexModeEnabled(bool mode)
*/
void DebugConsole::MAVLINKfilterEnabled(bool filter)
{
- filterMAVLINK = filter;
- bytesToIgnore = 0;
+ if (filterMAVLINK != filter)
+ {
+ filterMAVLINK = filter;
+ bytesToIgnore = 0;
+ if (m_ui->mavlinkCheckBox->isChecked() != filter)
+ {
+ m_ui->mavlinkCheckBox->setChecked(filter);
+ }
+ }
}
/**
* @param hold Freeze the input and thus any scrolling
*/
void DebugConsole::hold(bool hold)
{
+ if (holdOn != hold)
+ {
// Check if we need to append bytes from the hold buffer
if (this->holdOn && !hold)
{
@@ -654,6 +720,11 @@ void DebugConsole::hold(bool hold)
{
m_ui->receiveText->setTextInteractionFlags(Qt::NoTextInteraction);
}
+ if (m_ui->holdCheckBox->isChecked() != hold)
+ {
+ m_ui->holdCheckBox->setChecked(hold);
+ }
+}
}
/**
diff --git a/src/ui/DebugConsole.h b/src/ui/DebugConsole.h
index dc6ef02b9ead1c029fcb05e615ba33a6c2b14426..e0fd81dfed27734784e2b1943a6672dcdcc0f3dc 100644
--- a/src/ui/DebugConsole.h
+++ b/src/ui/DebugConsole.h
@@ -96,6 +96,8 @@ public slots:
void paintEvent(QPaintEvent *event);
/** @brief Update traffic measurements */
void updateTrafficMeasurements();
+ void loadSettings();
+ void storeSettings();
protected:
void changeEvent(QEvent *e);
@@ -109,14 +111,12 @@ protected:
void cycleCommandHistory(bool up);
QList links;
- QStringList commandHistory;
- QString currCommand;
- int commandIndex;
LinkInterface* currLink;
bool holdOn; ///< Hold current view, ignore new data
bool convertToAscii; ///< Convert data to ASCII
bool filterMAVLINK; ///< Set true to filter out MAVLink in output
+ bool autoHold; ///< Auto-hold mode sets view into hold if the data rate is too high
int bytesToIgnore; ///< Number of bytes to ignore
char lastByte; ///< The last received byte
QList sentBytes; ///< Transmitted bytes, per transmission
@@ -129,7 +129,9 @@ protected:
float dataRate; ///< Current data rate
float lowpassDataRate; ///< Lowpass filtered data rate
float dataRateThreshold; ///< Threshold where to enable auto-hold
- bool autoHold; ///< Auto-hold mode sets view into hold if the data rate is too high
+ QStringList commandHistory;
+ QString currCommand;
+ int commandIndex;
private:
Ui::DebugConsole *m_ui;
diff --git a/src/ui/map3D/QGCGoogleEarthView.ui b/src/ui/map3D/QGCGoogleEarthView.ui
index 9fd726a4a071f113cdac3920bc17baffa3dd6acd..56f0f4eb51c97041b3a4047d81fe7e173c5e7736 100644
--- a/src/ui/map3D/QGCGoogleEarthView.ui
+++ b/src/ui/map3D/QGCGoogleEarthView.ui
@@ -158,7 +158,7 @@
-
-
+
Delete all waypoints
@@ -169,7 +169,7 @@
Delete all waypoints
- Clear WPs
+ Clear Trails