diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index dc1b6275c2c01bed7196c14e6328b948bc53dd4c..cf92e8f34962495334d99cabfa61ac163415c838 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -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(); - 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; } } diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc index e731fc3ee08c1248910aa31f444dcffa3801c5f3..0188b549bb65377fcc5fcb056eb961c5ac030f5f 100644 --- a/src/comm/TCPLink.cc +++ b/src/comm/TCPLink.cc @@ -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(); - Q_UNUSED(idMetaType); - _linkId = getNextLinkId(); _resetName(); diff --git a/src/main.cc b/src/main.cc index a660902b98adc548abd0131a3006c655a6a67c9f..1b0e8846a8ebf0a2ca3123528a0c922d7f295072 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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(); + qRegisterMetaType(); #ifdef QT_DEBUG if (argc > 1 && QString(argv[1]).compare("--unittest", Qt::CaseInsensitive) == 0) {