Commit 9e38f8ca authored by Don Gagne's avatar Don Gagne

Moved qRegisterMetaType calls to main

Also commented out noisy serial link error output
parent 8b4a3854
......@@ -26,10 +26,6 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl,
m_stopp(false),
m_reqReset(false)
{
// We use QSerialPort::SerialPortError in a signal so we must declare it as a meta type
static const int idMetaType = qRegisterMetaType<QSerialPort::SerialPortError>();
Q_UNUSED(idMetaType);
// Get the name of the current port in use.
m_portName = portname.trimmed();
if (m_portName == "" && getCurrentPorts().size() > 0)
......@@ -449,7 +445,11 @@ bool SerialLink::hardwareConnect()
void SerialLink::linkError(QSerialPort::SerialPortError error)
{
if (error != QSerialPort::NoError) {
qDebug() << "SerialLink::linkError" << error;
// You can use the following qDebug output as needed during development. Make sure to comment it back out
// when you are done. The reason for this is that this signal is very noisy. For example if you try to
// connect to a PixHawk before it is ready to accept the connection it will output a continuous stream
// of errors until the Pixhawk responds.
//qDebug() << "SerialLink::linkError" << error;
}
}
......
......@@ -43,12 +43,6 @@ TCPLink::TCPLink(QHostAddress hostAddress, quint16 socketPort) :
_socket(NULL),
_socketIsConnected(false)
{
// Even though QAbstractSocket::SocketError is used in a signal by Qt, Qt doesn't declare it as a meta type.
// This in turn causes debug output to be kicked out about not being able to queue the signal. We register it
// as a meta type to silence that.
static const int idMetaType = qRegisterMetaType<QAbstractSocket::SocketError>();
Q_UNUSED(idMetaType);
_linkId = getNextLinkId();
_resetName();
......
......@@ -32,6 +32,8 @@ This file is part of the QGROUNDCONTROL project
#include "QGCCore.h"
#include "MainWindow.h"
#include "configuration.h"
#include "SerialLink.h"
#include "TCPLink.h"
#ifdef QT_DEBUG
#include "AutoTest.h"
#endif
......@@ -70,6 +72,13 @@ int main(int argc, char *argv[])
#ifdef Q_OS_WIN
qInstallMsgHandler( msgHandler );
#endif
// The following calls to qRegisterMetaType are done to silence debug output which warns
// that we use these types in signals, and without calling qRegisterMetaType we can't queue
// these signals. In general we don't queue these signals, but we do what the warning says
// anyway to silence the debug output.
qRegisterMetaType<QSerialPort::SerialPortError>();
qRegisterMetaType<QAbstractSocket::SocketError>();
#ifdef QT_DEBUG
if (argc > 1 && QString(argv[1]).compare("--unittest", Qt::CaseInsensitive) == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment