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
0198ce3e
Commit
0198ce3e
authored
Oct 22, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
7640bd3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
21 deletions
+29
-21
SerialSettingsDialog.cc
src/ui/configuration/SerialSettingsDialog.cc
+1
-0
PX4Bootloader.cc
src/ui/px4_configuration/PX4Bootloader.cc
+28
-21
No files found.
src/ui/configuration/SerialSettingsDialog.cc
View file @
0198ce3e
...
...
@@ -148,6 +148,7 @@ void SettingsDialog::fillPortsParameters()
void
SettingsDialog
::
fillPortsInfo
()
{
ui
->
serialPortInfoListBox
->
clear
();
QList
<
QSerialPortInfo
>
list
=
QSerialPortInfo
::
availablePorts
();
foreach
(
const
QSerialPortInfo
&
info
,
QSerialPortInfo
::
availablePorts
())
{
QStringList
list
;
list
<<
info
.
portName
()
...
...
src/ui/px4_configuration/PX4Bootloader.cc
View file @
0198ce3e
...
...
@@ -119,6 +119,12 @@ Again:
bool
PX4Bootloader
::
write
(
QSerialPort
*
port
,
const
uint8_t
*
data
,
qint64
maxSize
)
{
// Make sure we don't overflow output buffer
while
(
port
->
bytesToWrite
()
>
50
)
{
int
bump
=
0
;
bump
++
;
}
qint64
bytesWritten
=
port
->
write
((
const
char
*
)
data
,
maxSize
);
if
(
bytesWritten
==
-
1
)
{
_errorString
=
tr
(
"Write failed: %1"
).
arg
(
port
->
errorString
());
...
...
@@ -147,34 +153,35 @@ bool PX4Bootloader::write(QSerialPort* port, const uint8_t byte)
bool
PX4Bootloader
::
read
(
QSerialPort
*
port
,
uint8_t
*
data
,
qint64
maxSize
,
bool
warnOnError
,
int
readTimeout
)
{
qint64
bytesRead
;
if
(
port
->
bytesAvailable
()
<
maxSize
)
{
if
(
!
port
->
waitForReadyRead
(
readTimeout
))
{
_errorString
=
tr
(
"Timeout waiting for read bytes available: %1"
).
arg
(
port
->
errorString
());
qint64
bytesToRead
=
0
;
while
(
bytesToRead
<
maxSize
)
{
if
(
port
->
bytesAvailable
()
==
0
)
{
if
(
!
port
->
waitForReadyRead
(
readTimeout
))
{
_errorString
=
tr
(
"Timeout waiting for byte to be available"
);
if
(
warnOnError
)
{
qWarning
()
<<
_errorString
;
}
return
false
;
}
Q_ASSERT
(
port
->
bytesAvailable
()
!=
0
);
}
qint64
bytesRead
;
bytesRead
=
port
->
read
((
char
*
)
&
data
[
bytesToRead
],
maxSize
);
if
(
bytesRead
==
-
1
)
{
_errorString
=
tr
(
"Read failed: Could not read 1 byte, error: %1"
).
arg
(
port
->
errorString
());
if
(
warnOnError
)
{
qWarning
()
<<
_errorString
;
}
return
false
;
}
else
{
Q_ASSERT
(
bytesRead
!=
0
);
bytesToRead
+=
bytesRead
;
}
}
bytesRead
=
port
->
read
((
char
*
)
data
,
maxSize
);
if
(
bytesRead
==
-
1
)
{
_errorString
=
tr
(
"Read failed: Could not read %1 resonse, error: 12"
).
arg
(
port
->
errorString
());
if
(
warnOnError
)
{
qWarning
()
<<
_errorString
;
}
return
false
;
}
if
(
bytesRead
!=
maxSize
)
{
_errorString
=
tr
(
"In correct number of bytes returned for read: actual(%1) expected(%2)"
).
arg
(
bytesRead
).
arg
(
maxSize
);
if
(
warnOnError
)
{
qWarning
()
<<
_errorString
;
}
return
false
;
}
return
true
;
}
...
...
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