Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
71e284cd
Commit
71e284cd
authored
May 26, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not try to talk to bootloaders in the main flight code management routines
parent
323d162e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
SerialLink.cc
src/comm/SerialLink.cc
+48
-0
SerialLink.h
src/comm/SerialLink.h
+3
-0
No files found.
src/comm/SerialLink.cc
View file @
71e284cd
...
...
@@ -115,6 +115,32 @@ QList<QString> SerialLink::getCurrentPorts()
return
m_ports
;
}
bool
SerialLink
::
isBootloader
()
{
QList
<
QSerialPortInfo
>
portList
=
QSerialPortInfo
::
availablePorts
();
if
(
portList
.
count
()
==
0
){
return
false
;
}
foreach
(
const
QSerialPortInfo
&
info
,
portList
)
{
// qDebug() << "PortName : " << info.portName()
// << "Description : " << info.description();
// qDebug() << "Manufacturer: " << info.manufacturer();
if
(
info
.
portName
().
trimmed
()
==
this
->
m_portName
.
trimmed
()
&&
(
info
.
description
().
toLower
().
contains
(
"bootloader"
)
||
info
.
description
().
toLower
().
contains
(
"px4 bl"
)))
{
qDebug
()
<<
"BOOTLOADER FOUND"
;
return
true
;
}
}
// Not found
return
false
;
}
void
SerialLink
::
loadSettings
()
{
// Load defaults from settings
...
...
@@ -445,6 +471,28 @@ bool SerialLink::hardwareConnect(QString &type)
}
qDebug
()
<<
"SerialLink: hardwareConnect to "
<<
m_portName
;
if
(
isBootloader
())
{
qDebug
()
<<
"Not connecting to a bootloader, waiting for 2nd chance"
;
const
unsigned
retry_limit
=
12
;
unsigned
retries
;
for
(
retries
=
0
;
retries
<
retry_limit
;
retries
++
)
{
if
(
!
isBootloader
())
{
break
;
}
QGC
::
SLEEP
::
msleep
(
500
);
}
// Check limit
if
(
retries
==
retry_limit
)
{
// bail out
return
false
;
}
}
m_port
=
new
QSerialPort
(
m_portName
);
m_port
->
moveToThread
(
this
);
...
...
src/comm/SerialLink.h
View file @
71e284cd
...
...
@@ -72,6 +72,9 @@ public:
/** @brief Get a list of the currently available ports */
QList
<
QString
>
getCurrentPorts
();
/** @brief Check if the current port is a bootloader */
bool
isBootloader
();
void
requestReset
();
bool
isConnected
()
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment