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
e6f5eb34
Commit
e6f5eb34
authored
Dec 01, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2325 from DonLakeFlyer/RadioFlash
More reliable radio flash
parents
7b229e54
3b32cb30
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
23 deletions
+29
-23
QGCLoggingCategory.cc
src/QGCLoggingCategory.cc
+2
-1
QGCLoggingCategory.h
src/QGCLoggingCategory.h
+1
-0
Bootloader.cc
src/VehicleSetup/Bootloader.cc
+3
-3
FirmwareImage.cc
src/VehicleSetup/FirmwareImage.cc
+2
-2
PX4FirmwareUpgradeThread.cc
src/VehicleSetup/PX4FirmwareUpgradeThread.cc
+21
-17
No files found.
src/QGCLoggingCategory.cc
View file @
e6f5eb34
...
...
@@ -27,7 +27,8 @@
#include "QGCLoggingCategory.h"
// Add Global logging categories (not class specific) here using QGC_LOGGING_CATEGORY
QGC_LOGGING_CATEGORY
(
FirmwareUpgradeLog
,
"FirmwareUpgradeLog"
)
QGC_LOGGING_CATEGORY
(
FirmwareUpgradeLog
,
"FirmwareUpgradeLog"
)
QGC_LOGGING_CATEGORY
(
FirmwareUpgradeVerboseLog
,
"FirmwareUpgradeVerboseLog"
)
QGCLoggingCategoryRegister
*
_instance
=
NULL
;
...
...
src/QGCLoggingCategory.h
View file @
e6f5eb34
...
...
@@ -32,6 +32,7 @@
// Add Global logging categories (not class specific) here using Q_DECLARE_LOGGING_CATEGORY
Q_DECLARE_LOGGING_CATEGORY
(
FirmwareUpgradeLog
)
Q_DECLARE_LOGGING_CATEGORY
(
FirmwareUpgradeVerboseLog
)
/// @def QGC_LOGGING_CATEGORY
/// This is a QGC specific replacement for Q_LOGGING_CATEGORY. It will register the category name into a
...
...
src/VehicleSetup/Bootloader.cc
View file @
e6f5eb34
...
...
@@ -273,7 +273,7 @@ bool Bootloader::_ihxProgram(QextSerialPort* port, const FirmwareImage* image)
return
false
;
}
qCDebug
(
FirmwareUpgradeLog
)
<<
QString
(
"Bootloader::_ihxProgram - address:%1 size:%2 block:%3"
).
arg
(
flashAddress
).
arg
(
bytes
.
count
()).
arg
(
index
);
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
QString
(
"Bootloader::_ihxProgram - address:%1 size:%2 block:%3"
).
arg
(
flashAddress
).
arg
(
bytes
.
count
()).
arg
(
index
);
// Set flash address
...
...
@@ -348,7 +348,7 @@ bool Bootloader::verify(QextSerialPort* port, const FirmwareImage* image)
return
ret
;
}
/// @brief Verify the flash on bootloader
eading it back and comparing it against the original image->
/// @brief Verify the flash on bootloader
reading it back and comparing it against the original image
bool
Bootloader
::
_verifyBytes
(
QextSerialPort
*
port
,
const
FirmwareImage
*
image
)
{
if
(
image
->
imageIsBinFormat
())
{
...
...
@@ -445,7 +445,7 @@ bool Bootloader::_ihxVerifyBytes(QextSerialPort* port, const FirmwareImage* imag
return
false
;
}
qCDebug
(
FirmwareUpgradeLog
)
<<
QString
(
"Bootloader::_ihxVerifyBytes - address:
%1 size:%2 block:%3"
).
arg
(
readAddress
).
arg
(
imageBytes
.
count
()).
arg
(
index
);
qCDebug
(
FirmwareUpgradeLog
)
<<
QString
(
"Bootloader::_ihxVerifyBytes - address:
0x%1 size:%2 block:%3"
).
arg
(
readAddress
,
8
,
16
,
QLatin1Char
(
'0'
)
).
arg
(
imageBytes
.
count
()).
arg
(
index
);
// Set read address
...
...
src/VehicleSetup/FirmwareImage.cc
View file @
e6f5eb34
...
...
@@ -165,7 +165,7 @@ bool FirmwareImage::_ihxLoad(const QString& ihxFilename)
if
(
appendToLastBlock
)
{
_ihxBlocks
[
_ihxBlocks
.
count
()
-
1
].
bytes
+=
bytes
;
qCDebug
(
FirmwareUpgradeLog
)
<<
QString
(
"_ihxLoad - append - address:%1 size:%2 block:%3"
).
arg
(
address
).
arg
(
blockByteCount
).
arg
(
ihxBlockCount
());
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
QString
(
"_ihxLoad - append - address:%1 size:%2 block:%3"
).
arg
(
address
).
arg
(
blockByteCount
).
arg
(
ihxBlockCount
());
}
else
{
IntelHexBlock_t
block
;
...
...
@@ -173,7 +173,7 @@ bool FirmwareImage::_ihxLoad(const QString& ihxFilename)
block
.
bytes
=
bytes
;
_ihxBlocks
+=
block
;
qCDebug
(
FirmwareUpgradeLog
)
<<
QString
(
"_ihxLoad - new block - address:%1 size:%2 block:%3"
).
arg
(
address
).
arg
(
blockByteCount
).
arg
(
ihxBlockCount
());
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
QString
(
"_ihxLoad - new block - address:%1 size:%2 block:%3"
).
arg
(
address
).
arg
(
blockByteCount
).
arg
(
ihxBlockCount
());
}
_imageSize
+=
blockByteCount
;
...
...
src/VehicleSetup/PX4FirmwareUpgradeThread.cc
View file @
e6f5eb34
...
...
@@ -132,13 +132,13 @@ void PX4FirmwareUpgradeThreadWorker::_findBoardOnce(void)
bool
PX4FirmwareUpgradeThreadWorker
::
_findBoardFromPorts
(
QGCSerialPortInfo
&
portInfo
,
QGCSerialPortInfo
::
BoardType_t
&
boardType
)
{
foreach
(
QGCSerialPortInfo
info
,
QGCSerialPortInfo
::
availablePorts
())
{
qCDebug
(
FirmwareUpgradeLog
)
<<
"Serial Port --------------"
;
qCDebug
(
FirmwareUpgradeLog
)
<<
"
\t
board type"
<<
info
.
boardType
();
qCDebug
(
FirmwareUpgradeLog
)
<<
"
\t
port name:"
<<
info
.
portName
();
qCDebug
(
FirmwareUpgradeLog
)
<<
"
\t
description:"
<<
info
.
description
();
qCDebug
(
FirmwareUpgradeLog
)
<<
"
\t
system location:"
<<
info
.
systemLocation
();
qCDebug
(
FirmwareUpgradeLog
)
<<
"
\t
vendor ID:"
<<
info
.
vendorIdentifier
();
qCDebug
(
FirmwareUpgradeLog
)
<<
"
\t
product ID:"
<<
info
.
productIdentifier
();
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"Serial Port --------------"
;
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"
\t
board type"
<<
info
.
boardType
();
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"
\t
port name:"
<<
info
.
portName
();
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"
\t
description:"
<<
info
.
description
();
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"
\t
system location:"
<<
info
.
systemLocation
();
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"
\t
vendor ID:"
<<
info
.
vendorIdentifier
();
qCDebug
(
FirmwareUpgrade
Verbose
Log
)
<<
"
\t
product ID:"
<<
info
.
productIdentifier
();
boardType
=
info
.
boardType
();
if
(
boardType
!=
QGCSerialPortInfo
::
BoardTypeUnknown
)
{
...
...
@@ -167,13 +167,8 @@ void PX4FirmwareUpgradeThreadWorker::_3drRadioForceBootloader(const QGCSerialPor
emit
status
(
"Putting radio into command mode"
);
// Wait a little while for the USB port to initialize. 3DR Radio boot is really slow.
for
(
int
i
=
0
;
i
<
12
;
i
++
)
{
if
(
port
.
open
(
QIODevice
::
ReadWrite
))
{
break
;
}
else
{
QGC
::
SLEEP
::
msleep
(
250
);
}
}
QGC
::
SLEEP
::
msleep
(
2000
);
port
.
open
(
QIODevice
::
ReadWrite
);
if
(
!
port
.
isOpen
())
{
emit
error
(
QString
(
"Unable to open port: %1 error: %2"
).
arg
(
portInfo
.
systemLocation
()).
arg
(
port
.
errorString
()));
...
...
@@ -181,6 +176,7 @@ void PX4FirmwareUpgradeThreadWorker::_3drRadioForceBootloader(const QGCSerialPor
}
// Put radio into command mode
QGC
::
SLEEP
::
msleep
(
2000
);
port
.
write
(
"+++"
,
3
);
if
(
!
port
.
waitForReadyRead
(
1500
))
{
emit
error
(
"Unable to put radio into command mode"
);
...
...
@@ -188,6 +184,7 @@ void PX4FirmwareUpgradeThreadWorker::_3drRadioForceBootloader(const QGCSerialPor
}
QByteArray
bytes
=
port
.
readAll
();
if
(
!
bytes
.
contains
(
"OK"
))
{
qCDebug
(
FirmwareUpgradeLog
)
<<
bytes
;
emit
error
(
"Unable to put radio into command mode"
);
return
;
}
...
...
@@ -196,10 +193,14 @@ void PX4FirmwareUpgradeThreadWorker::_3drRadioForceBootloader(const QGCSerialPor
port
.
write
(
"AT&UPDATE
\r\n
"
);
if
(
!
port
.
waitForBytesWritten
(
1500
))
{
emit
error
(
"Unable to reboot radio"
);
emit
error
(
"Unable to reboot radio
(bytes written)
"
);
return
;
}
QGC
::
SLEEP
::
msleep
(
2000
);
if
(
!
port
.
waitForReadyRead
(
1500
))
{
emit
error
(
"Unable to reboot radio (ready read)"
);
return
;
}
QGC
::
SLEEP
::
msleep
(
700
);
port
.
close
();
// The bootloader should be waiting for us now
...
...
@@ -218,7 +219,10 @@ bool PX4FirmwareUpgradeThreadWorker::_findBootloader(const QGCSerialPortInfo& po
_bootloaderPort
=
new
QextSerialPort
(
QextSerialPort
::
Polling
);
Q_CHECK_PTR
(
_bootloaderPort
);
if
(
radioMode
)
{
_bootloaderPort
->
setBaudRate
(
BAUD115200
);
}
// Wait a little while for the USB port to initialize.
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
if
(
_bootloader
->
open
(
_bootloaderPort
,
portInfo
.
systemLocation
()))
{
...
...
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