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
f8ca385d
Commit
f8ca385d
authored
Dec 18, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show APM firmware versions when flashing
parent
45e47189
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
263 additions
and
147 deletions
+263
-147
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
FirmwareUpgrade.qml
src/VehicleSetup/FirmwareUpgrade.qml
+11
-64
FirmwareUpgradeController.cc
src/VehicleSetup/FirmwareUpgradeController.cc
+220
-74
FirmwareUpgradeController.h
src/VehicleSetup/FirmwareUpgradeController.h
+30
-9
No files found.
qgroundcontrol.pro
View file @
f8ca385d
...
@@ -262,6 +262,7 @@ HEADERS += \
...
@@ -262,6 +262,7 @@ HEADERS += \
src
/
QGCComboBox
.
h
\
src
/
QGCComboBox
.
h
\
src
/
QGCConfig
.
h
\
src
/
QGCConfig
.
h
\
src
/
QGCDockWidget
.
h
\
src
/
QGCDockWidget
.
h
\
src
/
QGCFileDownload
.
h
\
src
/
QGCGeo
.
h
\
src
/
QGCGeo
.
h
\
src
/
QGCLoggingCategory
.
h
\
src
/
QGCLoggingCategory
.
h
\
src
/
QGCMapPalette
.
h
\
src
/
QGCMapPalette
.
h
\
...
@@ -382,6 +383,7 @@ SOURCES += \
...
@@ -382,6 +383,7 @@ SOURCES += \
src
/
QGCApplication
.
cc
\
src
/
QGCApplication
.
cc
\
src
/
QGCComboBox
.
cc
\
src
/
QGCComboBox
.
cc
\
src
/
QGCDockWidget
.
cc
\
src
/
QGCDockWidget
.
cc
\
src
/
QGCFileDownload
.
cc
\
src
/
QGCLoggingCategory
.
cc
\
src
/
QGCLoggingCategory
.
cc
\
src
/
QGCMapPalette
.
cc
\
src
/
QGCMapPalette
.
cc
\
src
/
QGCPalette
.
cc
\
src
/
QGCPalette
.
cc
\
...
...
src/VehicleSetup/FirmwareUpgrade.qml
View file @
f8ca385d
...
@@ -164,7 +164,7 @@ QGCView {
...
@@ -164,7 +164,7 @@ QGCView {
var
firmwareType
=
firmwareVersionCombo
.
model
.
get
(
firmwareVersionCombo
.
currentIndex
).
firmwareType
var
firmwareType
=
firmwareVersionCombo
.
model
.
get
(
firmwareVersionCombo
.
currentIndex
).
firmwareType
var
vehicleType
=
FirmwareUpgradeController
.
DefaultVehicleFirmware
var
vehicleType
=
FirmwareUpgradeController
.
DefaultVehicleFirmware
if
(
apmFlightStack
.
checked
)
{
if
(
apmFlightStack
.
checked
)
{
vehicleType
=
vehicleTypeSelectionCombo
.
model
.
get
(
vehicleTypeSelectionCombo
.
currentIndex
).
vehicleType
vehicleType
=
controller
.
vehicleTypeFromVersionIndex
(
vehicleTypeSelectionCombo
.
currentIndex
)
}
}
controller
.
flash
(
stack
,
firmwareType
,
vehicleType
)
controller
.
flash
(
stack
,
firmwareType
,
vehicleType
)
}
}
...
@@ -199,47 +199,6 @@ QGCView {
...
@@ -199,47 +199,6 @@ QGCView {
}
}
}
}
ListModel
{
id
:
vehicleTypeList
ListElement
{
text
:
"
Quad
"
vehicleType
:
FirmwareUpgradeController
.
QuadFirmware
}
ListElement
{
text
:
"
X8
"
vehicleType
:
FirmwareUpgradeController
.
X8Firmware
}
ListElement
{
text
:
"
Hexa
"
vehicleType
:
FirmwareUpgradeController
.
HexaFirmware
}
ListElement
{
text
:
"
Octo
"
vehicleType
:
FirmwareUpgradeController
.
OctoFirmware
}
ListElement
{
text
:
"
Y
"
vehicleType
:
FirmwareUpgradeController
.
YFirmware
}
ListElement
{
text
:
"
Y6
"
vehicleType
:
FirmwareUpgradeController
.
Y6Firmware
}
ListElement
{
text
:
"
Heli
"
vehicleType
:
FirmwareUpgradeController
.
HeliFirmware
}
ListElement
{
text
:
"
Plane
"
vehicleType
:
FirmwareUpgradeController
.
PlaneFirmware
}
ListElement
{
text
:
"
Rover
"
vehicleType
:
FirmwareUpgradeController
.
RoverFirmware
}
}
ListModel
{
ListModel
{
id
:
px4FlowTypeList
id
:
px4FlowTypeList
...
@@ -274,17 +233,6 @@ QGCView {
...
@@ -274,17 +233,6 @@ QGCView {
firmwareVersionCombo
.
currentIndex
=
0
firmwareVersionCombo
.
currentIndex
=
0
}
}
function
vehicleTypeChanged
(
model
)
{
vehicleTypeSelectionCombo
.
model
=
null
// All of this bizarre, setting model to null and index to 1 and then to 0 is to work around
// strangeness in the combo box implementation. This sequence of steps correctly changes the combo model
// without generating any warnings and correctly updates the combo text with the new selection.
vehicleTypeSelectionCombo
.
model
=
null
vehicleTypeSelectionCombo
.
model
=
model
vehicleTypeSelectionCombo
.
currentIndex
=
1
vehicleTypeSelectionCombo
.
currentIndex
=
0
}
QGCRadioButton
{
QGCRadioButton
{
id
:
px4FlightStack
id
:
px4FlightStack
checked
:
true
checked
:
true
...
@@ -301,10 +249,7 @@ QGCView {
...
@@ -301,10 +249,7 @@ QGCView {
text
:
"
APM Flight Stack
"
text
:
"
APM Flight Stack
"
visible
:
!
px4Flow
visible
:
!
px4Flow
onClicked
:
{
onClicked
:
parent
.
firmwareVersionChanged
(
firmwareTypeList
)
parent
.
firmwareVersionChanged
(
firmwareTypeList
)
parent
.
vehicleTypeChanged
(
vehicleTypeList
)
}
}
}
QGCLabel
{
QGCLabel
{
...
@@ -317,19 +262,21 @@ QGCView {
...
@@ -317,19 +262,21 @@ QGCView {
Row
{
Row
{
spacing
:
10
spacing
:
10
QGCComboBox
{
QGCComboBox
{
id
:
firmwareVersionCombo
id
:
firmwareVersionCombo
width
:
200
width
:
200
visible
:
showFirmwareTypeSelection
visible
:
showFirmwareTypeSelection
model
:
px4Flow
?
px4FlowTypeList
:
firmwareTypeList
model
:
px4Flow
?
px4FlowTypeList
:
firmwareTypeList
currentIndex
:
controller
.
selectedFirmwareType
onActivated
:
{
onActivated
:
{
if
(
model
.
get
(
index
).
firmwareType
==
FirmwareUpgradeController
.
PX4BetaFirmware
||
FirmwareUpgradeController
.
APMBetaFirmware
)
{
controller
.
selectedFirmwareType
=
index
if
(
model
.
get
(
index
).
firmwareType
==
FirmwareUpgradeController
.
BetaFirmware
)
{
firmwareVersionWarningLabel
.
visible
=
true
firmwareVersionWarningLabel
.
visible
=
true
firmwareVersionWarningLabel
.
text
=
"
WARNING: BETA FIRMWARE.
"
+
firmwareVersionWarningLabel
.
text
=
"
WARNING: BETA FIRMWARE.
"
+
"
This firmware version is ONLY intended for beta testers.
"
+
"
This firmware version is ONLY intended for beta testers.
"
+
"
Although it has received FLIGHT TESTING, it represents actively changed code.
"
+
"
Although it has received FLIGHT TESTING, it represents actively changed code.
"
+
"
Do NOT use for normal operation.
"
"
Do NOT use for normal operation.
"
}
else
if
(
model
.
get
(
index
).
firmwareType
==
FirmwareUpgradeController
.
PX4DeveloperFirmware
||
FirmwareUpgradeController
.
APM
DeveloperFirmware
)
{
}
else
if
(
model
.
get
(
index
).
firmwareType
==
FirmwareUpgradeController
.
DeveloperFirmware
)
{
firmwareVersionWarningLabel
.
visible
=
true
firmwareVersionWarningLabel
.
visible
=
true
firmwareVersionWarningLabel
.
text
=
"
WARNING: CONTINUOUS BUILD FIRMWARE.
"
+
firmwareVersionWarningLabel
.
text
=
"
WARNING: CONTINUOUS BUILD FIRMWARE.
"
+
"
This firmware has NOT BEEN FLIGHT TESTED.
"
+
"
This firmware has NOT BEEN FLIGHT TESTED.
"
+
...
@@ -347,7 +294,7 @@ QGCView {
...
@@ -347,7 +294,7 @@ QGCView {
id
:
vehicleTypeSelectionCombo
id
:
vehicleTypeSelectionCombo
width
:
200
width
:
200
visible
:
apmFlightStack
.
checked
visible
:
apmFlightStack
.
checked
model
:
vehicleTypeList
model
:
controller
.
apmAvailableVersions
}
}
}
}
...
...
src/VehicleSetup/FirmwareUpgradeController.cc
View file @
f8ca385d
This diff is collapsed.
Click to expand it.
src/VehicleSetup/FirmwareUpgradeController.h
View file @
f8ca385d
...
@@ -106,10 +106,12 @@ public:
...
@@ -106,10 +106,12 @@ public:
FirmwareUpgradeController
(
void
);
FirmwareUpgradeController
(
void
);
~
FirmwareUpgradeController
();
~
FirmwareUpgradeController
();
Q_PROPERTY
(
QString
boardPort
READ
boardPort
NOTIFY
boardFound
)
Q_PROPERTY
(
QString
boardPort
READ
boardPort
NOTIFY
boardFound
)
Q_PROPERTY
(
QString
boardDescription
READ
boardDescription
NOTIFY
boardFound
)
Q_PROPERTY
(
QString
boardDescription
READ
boardDescription
NOTIFY
boardFound
)
Q_PROPERTY
(
QString
boardType
MEMBER
_foundBoardType
NOTIFY
boardFound
)
Q_PROPERTY
(
QString
boardType
MEMBER
_foundBoardTypeName
NOTIFY
boardFound
)
Q_PROPERTY
(
FirmwareType_t
selectedFirmwareType
READ
selectedFirmwareType
WRITE
setSelectedFirmwareType
NOTIFY
selectedFirmwareTypeChanged
)
Q_PROPERTY
(
QStringList
apmAvailableVersions
READ
apmAvailableVersions
NOTIFY
apmAvailableVersionsChanged
)
/// TextArea for log output
/// TextArea for log output
Q_PROPERTY
(
QQuickItem
*
statusLog
READ
statusLog
WRITE
setStatusLog
)
Q_PROPERTY
(
QQuickItem
*
statusLog
READ
statusLog
WRITE
setStatusLog
)
...
@@ -126,6 +128,8 @@ public:
...
@@ -126,6 +128,8 @@ public:
Q_INVOKABLE
void
flash
(
AutoPilotStackType_t
stackType
,
Q_INVOKABLE
void
flash
(
AutoPilotStackType_t
stackType
,
FirmwareType_t
firmwareType
=
StableFirmware
,
FirmwareType_t
firmwareType
=
StableFirmware
,
FirmwareVehicleType_t
vehicleType
=
DefaultVehicleFirmware
);
FirmwareVehicleType_t
vehicleType
=
DefaultVehicleFirmware
);
Q_INVOKABLE
FirmwareVehicleType_t
vehicleTypeFromVersionIndex
(
int
index
);
// overload, not exposed to qml side
// overload, not exposed to qml side
void
flash
(
const
FirmwareIdentifier
&
firmwareId
);
void
flash
(
const
FirmwareIdentifier
&
firmwareId
);
...
@@ -140,6 +144,11 @@ public:
...
@@ -140,6 +144,11 @@ public:
QString
boardPort
(
void
)
{
return
_foundBoardInfo
.
portName
();
}
QString
boardPort
(
void
)
{
return
_foundBoardInfo
.
portName
();
}
QString
boardDescription
(
void
)
{
return
_foundBoardInfo
.
description
();
}
QString
boardDescription
(
void
)
{
return
_foundBoardInfo
.
description
();
}
FirmwareType_t
selectedFirmwareType
(
void
)
{
return
_selectedFirmwareType
;
}
void
setSelectedFirmwareType
(
FirmwareType_t
firmwareType
);
QStringList
apmAvailableVersions
(
void
);
signals:
signals:
void
boardFound
(
void
);
void
boardFound
(
void
);
...
@@ -148,12 +157,14 @@ signals:
...
@@ -148,12 +157,14 @@ signals:
void
flashComplete
(
void
);
void
flashComplete
(
void
);
void
flashCancelled
(
void
);
void
flashCancelled
(
void
);
void
error
(
void
);
void
error
(
void
);
void
selectedFirmwareTypeChanged
(
FirmwareType_t
firmwareType
);
void
apmAvailableVersionsChanged
(
void
);
private
slots
:
private
slots
:
void
_downloadProgress
(
qint64
curr
,
qint64
total
);
void
_downloadProgress
(
qint64
curr
,
qint64
total
);
void
_downloadFinished
(
void
);
void
_downloadFinished
(
void
);
void
_downloadError
(
QNetworkReply
::
NetworkError
code
);
void
_downloadError
(
QNetworkReply
::
NetworkError
code
);
void
_foundBoard
(
bool
firstAttempt
,
const
QSerialPortInfo
&
portInfo
,
int
t
ype
);
void
_foundBoard
(
bool
firstAttempt
,
const
QSerialPortInfo
&
portInfo
,
int
boardT
ype
);
void
_noBoardFound
(
void
);
void
_noBoardFound
(
void
);
void
_boardGone
();
void
_boardGone
();
void
_foundBootloader
(
int
bootloaderVersion
,
int
boardID
,
int
flashSize
);
void
_foundBootloader
(
int
bootloaderVersion
,
int
boardID
,
int
flashSize
);
...
@@ -165,6 +176,7 @@ private slots:
...
@@ -165,6 +176,7 @@ private slots:
void
_eraseStarted
(
void
);
void
_eraseStarted
(
void
);
void
_eraseComplete
(
void
);
void
_eraseComplete
(
void
);
void
_eraseProgressTick
(
void
);
void
_eraseProgressTick
(
void
);
void
_apmVersionDownloadFinished
(
QString
remoteFile
,
QString
localFile
);
private:
private:
void
_getFirmwareFile
(
FirmwareIdentifier
firmwareId
);
void
_getFirmwareFile
(
FirmwareIdentifier
firmwareId
);
...
@@ -172,7 +184,10 @@ private:
...
@@ -172,7 +184,10 @@ private:
void
_downloadFirmware
(
void
);
void
_downloadFirmware
(
void
);
void
_appendStatusLog
(
const
QString
&
text
,
bool
critical
=
false
);
void
_appendStatusLog
(
const
QString
&
text
,
bool
critical
=
false
);
void
_errorCancel
(
const
QString
&
msg
);
void
_errorCancel
(
const
QString
&
msg
);
void
_loadAPMVersions
(
QGCSerialPortInfo
::
BoardType_t
boardType
);
QHash
<
FirmwareIdentifier
,
QString
>*
_firmwareHashForBoardId
(
int
boardId
);
QHash
<
FirmwareIdentifier
,
QString
>*
_firmwareHashForBoardType
(
QGCSerialPortInfo
::
BoardType_t
boardType
);
QString
_portName
;
QString
_portName
;
QString
_portDescription
;
QString
_portDescription
;
...
@@ -184,6 +199,9 @@ private:
...
@@ -184,6 +199,9 @@ private:
QHash
<
FirmwareIdentifier
,
QString
>
_rgPX4FLowFirmware
;
QHash
<
FirmwareIdentifier
,
QString
>
_rgPX4FLowFirmware
;
QHash
<
FirmwareIdentifier
,
QString
>
_rg3DRRadioFirmware
;
QHash
<
FirmwareIdentifier
,
QString
>
_rg3DRRadioFirmware
;
QMap
<
FirmwareType_t
,
QMap
<
FirmwareVehicleType_t
,
QString
>
>
_apmVersionMap
;
QList
<
FirmwareVehicleType_t
>
_apmVehicleTypeFromCurrentVersionList
;
/// Information which comes back from the bootloader
/// Information which comes back from the bootloader
bool
_bootloaderFound
;
///< true: we have received the foundBootloader signals
bool
_bootloaderFound
;
///< true: we have received the foundBootloader signals
uint32_t
_bootloaderVersion
;
///< Bootloader version
uint32_t
_bootloaderVersion
;
///< Bootloader version
...
@@ -216,9 +234,12 @@ private:
...
@@ -216,9 +234,12 @@ private:
bool
_searchingForBoard
;
///< true: searching for board, false: search for bootloader
bool
_searchingForBoard
;
///< true: searching for board, false: search for bootloader
QSerialPortInfo
_foundBoardInfo
;
QSerialPortInfo
_foundBoardInfo
;
QString
_foundBoardType
;
QGCSerialPortInfo
::
BoardType_t
_foundBoardType
;
QString
_foundBoardTypeName
;
FirmwareType_t
_selectedFirmwareType
;
FirmwareImage
*
_image
;
FirmwareImage
*
_image
;
};
};
...
...
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