Commit eb811905 authored by Don Gagne's avatar Don Gagne

Merge pull request #1357 from dogmaphobic/serialPortFix

Serial port fix
parents 34337970 cb63f6de
......@@ -12,7 +12,7 @@
// If you need to make an incompatible changes to stored settings, bump this version number
// up by 1. This will caused store settings to be cleared on next boot.
#define QGC_SETTINGS_VERSION 3
#define QGC_SETTINGS_VERSION 4
#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_ORG_NAME "QGroundControl.org"
......
......@@ -465,7 +465,7 @@ void LinkManager::_updateConfigurationList(void)
#endif
// Is this a PX4?
if (portInfo.vendorIdentifier() == 9900) {
SerialConfiguration* pSerial = _findSerialConfiguration(portInfo.portName());
SerialConfiguration* pSerial = _findSerialConfiguration(portInfo.systemLocation());
if (pSerial) {
//-- If this port is configured make sure it has the preferred flag set
if(!pSerial->isPreferred()) {
......@@ -477,7 +477,7 @@ void LinkManager::_updateConfigurationList(void)
pSerial = new SerialConfiguration(QString("Pixhawk on %1").arg(portInfo.portName().trimmed()));
pSerial->setPreferred(true);
pSerial->setBaud(115200);
pSerial->setPortName(portInfo.portName());
pSerial->setPortName(portInfo.systemLocation());
addLinkConfiguration(pSerial);
saveList = true;
}
......
......@@ -588,7 +588,7 @@ QList<QString> SerialConfiguration::getCurrentPorts()
QList<QSerialPortInfo> portList = QSerialPortInfo::availablePorts();
foreach (const QSerialPortInfo &info, portList)
{
ports.append(info.portName());
ports.append(info.systemLocation());
}
return ports;
}
......@@ -137,10 +137,16 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config)
//-- Check for "Unnamed"
if (config->name() == tr("Unnamed")) {
switch(config->type()) {
case LinkConfiguration::TypeSerial:
config->setName(
QString("Serial Device on %1").arg(dynamic_cast<SerialConfiguration*>(config)->portName()));
case LinkConfiguration::TypeSerial: {
QString tname = dynamic_cast<SerialConfiguration*>(config)->portName();
#ifdef Q_OS_WIN32
tname.replace("\\\\.\\", "");
#else
tname.replace("/dev/", "");
#endif
config->setName(QString("Serial Device on %1").arg(tname));
break;
}
case LinkConfiguration::TypeUdp:
config->setName(
QString("UDP Link on Port %1").arg(dynamic_cast<UDPConfiguration*>(config)->localPort()));
......
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