From 8190209dc8015677fbe9d8e35fc823d2fbbeb6e2 Mon Sep 17 00:00:00 2001 From: Michael Carpenter Date: Tue, 25 Jun 2013 11:46:36 -0400 Subject: [PATCH] Fix for apm_planner issue #3, Serial port handling of '-' characters, since OSX can have a '-' in the port name --- src/ui/QGCToolBar.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 78ccac7aa..f18d4a221 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -608,9 +608,11 @@ void QGCToolBar::connectLink(bool connect) if (link) { QString portname = portComboBox->currentText().split(":")[2]; - if (portname.indexOf('-') != -1) + if (portname.indexOf('-') >= 0) { - portname = portname.split("-")[0]; + //Take everything before the last -, this ensures if the com port has a - in it, it will be included, + //since the last - is inserted by me. + portname = portname.mid(0,portname.lastIndexOf("-")-1); } link->setPortName(portname.trimmed()); } -- 2.22.0