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
cc99ed6b
Unverified
Commit
cc99ed6b
authored
May 31, 2019
by
Gus Grubba
Committed by
GitHub
May 31, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7485 from mavlink/customFirmware
Switch custom firmware file picker to QtQuick
parents
fa92eced
5499e8c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
11 deletions
+38
-11
FirmwareUpgrade.qml
src/VehicleSetup/FirmwareUpgrade.qml
+29
-5
FirmwareUpgradeController.cc
src/VehicleSetup/FirmwareUpgradeController.cc
+9
-6
No files found.
src/VehicleSetup/FirmwareUpgrade.qml
View file @
cc99ed6b
...
...
@@ -79,6 +79,18 @@ SetupPage {
_defaultFirmwareIsPX4
=
_defaultFirmwareFact
.
rawValue
===
_defaultFimwareTypePX4
// we don't want this to be bound and change as radios are selected
}
QGCFileDialog
{
id
:
customFirmwareDialog
title
:
qsTr
(
"
Select Firmware File
"
)
nameFilters
:
[
qsTr
(
"
Firmware Files (*.px4 *.apj *.bin *.ihx)
"
),
qsTr
(
"
All Files (*)
"
)]
selectExisting
:
true
folder
:
QGroundControl
.
settingsManager
.
appSettings
.
logSavePath
onAcceptedForLoad
:
{
controller
.
flashFirmwareUrl
(
file
)
close
()
}
}
FirmwareUpgradeController
{
id
:
controller
progressBar
:
progressBar
...
...
@@ -117,8 +129,9 @@ SetupPage {
statusTextArea
.
append
(
highlightPrefix
+
qsTr
(
"
Multiple devices detected! Remove all detected devices to perform the firmware upgrade.
"
))
statusTextArea
.
append
(
qsTr
(
"
Detected [%1]:
"
).
arg
(
availableDevices
.
length
)
+
availableDevices
.
join
(
"
,
"
))
}
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
autoDisconnect
=
true
if
(
QGroundControl
.
multiVehicleManager
.
activeVehicle
)
{
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
autoDisconnect
=
true
}
}
else
{
// We end up here when we detect a board plugged in after we've started upgrade
statusTextArea
.
append
(
highlightPrefix
+
qsTr
(
"
Found device
"
)
+
highlightSuffix
+
"
:
"
+
controller
.
boardType
)
...
...
@@ -210,7 +223,12 @@ SetupPage {
}
}
}
controller
.
flash
(
stack
,
firmwareBuildType
,
vehicleType
)
//-- If custom, get file path
if
(
firmwareBuildType
===
FirmwareUpgradeController
.
CustomFirmware
)
{
customFirmwareDialog
.
openForLoad
()
}
else
{
controller
.
flash
(
stack
,
firmwareBuildType
,
vehicleType
)
}
hideDialog
()
}
}
...
...
@@ -220,7 +238,6 @@ SetupPage {
cancelFlash
()
}
Connections
{
target
:
firmwarePage
onCancelDialog
:
reject
()
...
...
@@ -304,6 +321,13 @@ SetupPage {
Column
{
Component.onCompleted
:
{
if
(
!
QGroundControl
.
apmFirmwareSupported
)
{
_defaultFirmwareFact
.
rawValue
=
_defaultFimwareTypePX4
firmwareVersionChanged
(
firmwareBuildTypeList
)
}
}
QGCRadioButton
{
id
:
px4FlightStackRadio
text
:
qsTr
(
"
PX4 Pro
"
)
...
...
@@ -371,7 +395,7 @@ SetupPage {
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
No Firmware Available
"
)
visible
:
!
controller
.
downloadingFirmwareList
&&
controller
.
apmFirmwareNames
.
length
===
0
visible
:
!
controller
.
downloadingFirmwareList
&&
(
QGroundControl
.
apmFirmwareSupported
&&
controller
.
apmFirmwareNames
.
length
===
0
)
}
QGCComboBox
{
...
...
src/VehicleSetup/FirmwareUpgradeController.cc
View file @
cc99ed6b
...
...
@@ -93,12 +93,17 @@ FirmwareUpgradeController::FirmwareUpgradeController(void)
connect
(
&
_eraseTimer
,
&
QTimer
::
timeout
,
this
,
&
FirmwareUpgradeController
::
_eraseProgressTick
);
#if !defined(NO_ARDUPILOT_DIALECT)
connect
(
_apmChibiOSSetting
,
&
Fact
::
rawValueChanged
,
this
,
&
FirmwareUpgradeController
::
_buildAPMFirmwareNames
);
connect
(
_apmVehicleTypeSetting
,
&
Fact
::
rawValueChanged
,
this
,
&
FirmwareUpgradeController
::
_buildAPMFirmwareNames
);
#endif
_initFirmwareHash
();
_determinePX4StableVersion
();
#if !defined(NO_ARDUPILOT_DIALECT)
_downloadArduPilotManifest
();
#endif
}
FirmwareUpgradeController
::~
FirmwareUpgradeController
()
...
...
@@ -478,16 +483,12 @@ QHash<FirmwareUpgradeController::FirmwareIdentifier, QString>* FirmwareUpgradeCo
return
&
_rgFirmwareDynamic
;
}
/// @brief Prompts the user to select a firmware file if needed and moves the state machine to the next state.
void
FirmwareUpgradeController
::
_getFirmwareFile
(
FirmwareIdentifier
firmwareId
)
{
QHash
<
FirmwareIdentifier
,
QString
>*
prgFirmware
=
_firmwareHashForBoardId
(
static_cast
<
int
>
(
_bootloaderBoardID
));
if
(
firmwareId
.
firmwareType
==
CustomFirmware
)
{
_firmwareFilename
=
QString
();
//-- TODO: QGCQFileDialog::getOpenFileName(nullptr, // Parent to main window
// tr("Select Firmware File"), // Dialog Caption
// QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), // Initial directory
// tr("Firmware Files (*.px4 *.apj *.bin *.ihx)")); // File filter
_firmwareFilename
=
QString
();
_errorCancel
(
tr
(
"Custom firmware selected but no filename given."
));
}
else
{
if
(
prgFirmware
->
contains
(
firmwareId
))
{
_firmwareFilename
=
prgFirmware
->
value
(
firmwareId
);
...
...
@@ -673,6 +674,7 @@ void FirmwareUpgradeController::setSelectedFirmwareBuildType(FirmwareBuildType_t
void
FirmwareUpgradeController
::
_buildAPMFirmwareNames
(
void
)
{
#if !defined(NO_ARDUPILOT_DIALECT)
qCDebug
(
FirmwareUpgradeLog
)
<<
"_buildAPMFirmwareNames"
;
bool
chibios
=
_apmChibiOSSetting
->
rawValue
().
toInt
()
==
0
;
...
...
@@ -717,6 +719,7 @@ void FirmwareUpgradeController::_buildAPMFirmwareNames(void)
}
emit
apmFirmwareNamesChanged
();
#endif
}
FirmwareUpgradeController
::
FirmwareVehicleType_t
FirmwareUpgradeController
::
vehicleTypeFromFirmwareSelectionIndex
(
int
index
)
...
...
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