Browse Source

Merge pull request #697 from Susurrus/serialport

Removed constant debugging output from scanning for serial ports.
QGC4.4
Lorenz Meier 11 years ago
parent
commit
a39432661f
  1. 10
      src/comm/SerialLink.cc
  2. 11
      src/ui/SerialConfigurationWindow.cc
  3. 8
      src/ui/SerialConfigurationWindow.h

10
src/comm/SerialLink.cc

@ -99,19 +99,11 @@ QList<QString> SerialLink::getCurrentPorts() @@ -99,19 +99,11 @@ QList<QString> SerialLink::getCurrentPorts()
m_ports.clear();
QList<QSerialPortInfo> portList = QSerialPortInfo::availablePorts();
if( portList.count() == 0){
qDebug() << "No Ports Found" << m_ports;
}
foreach (const QSerialPortInfo &info, portList)
{
// qDebug() << "PortName : " << info.portName()
// << "Description : " << info.description();
// qDebug() << "Manufacturer: " << info.manufacturer();
m_ports.append(info.portName());
}
return m_ports;
}

11
src/ui/SerialConfigurationWindow.cc

@ -55,7 +55,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge @@ -55,7 +55,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
action = new QAction(QIcon(":/files/images/devices/network-wireless.svg"), "", this);
setLinkName(link->getName());
setupPortList();
// Scan for serial ports. Let the user know if none were found for debugging purposes
if (!setupPortList()) {
qDebug() << "No serial ports found.";
}
// Set up baud rates
ui.baudRate->clear();
@ -213,9 +216,9 @@ void SerialConfigurationWindow::configureCommunication() @@ -213,9 +216,9 @@ void SerialConfigurationWindow::configureCommunication()
this->show();
}
void SerialConfigurationWindow::setupPortList()
bool SerialConfigurationWindow::setupPortList()
{
if (!link) return;
if (!link) return false;
// Get the ports available on this system
QList<QString> ports = link->getCurrentPorts();
@ -240,6 +243,8 @@ void SerialConfigurationWindow::setupPortList() @@ -240,6 +243,8 @@ void SerialConfigurationWindow::setupPortList()
if (storedFound)
ui.portName->setEditText(storedName);
return (ports.count() > 0);
}
void SerialConfigurationWindow::enableFlowControl(bool flow)

8
src/ui/SerialConfigurationWindow.h

@ -60,7 +60,13 @@ public slots: @@ -60,7 +60,13 @@ public slots:
void setParityEven(bool accept);
void setPortName(QString port);
void setLinkName(QString name);
void setupPortList();
/**
* @brief setupPortList Populates the dropdown with the list of available serial ports.
* This function is called at 1s intervals to check that the serial port still exists and to see if
* any new ones have been attached.
* @return True if any ports were found, false otherwise.
*/
bool setupPortList();
protected:
void showEvent(QShowEvent* event);

Loading…
Cancel
Save