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
5505d423
Commit
5505d423
authored
Jul 30, 2015
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save airframe meta XML file during Firmware upgrades
parent
6368f2d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
FirmwareImage.cc
src/VehicleSetup/FirmwareImage.cc
+30
-2
No files found.
src/VehicleSetup/FirmwareImage.cc
View file @
5505d423
...
...
@@ -242,7 +242,6 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
QString
parameterFilename
=
parameterDir
.
filePath
(
"PX4ParameterFactMetaData.xml"
);
qDebug
()
<<
parameterFilename
;
QFile
parameterFile
(
parameterFilename
);
if
(
parameterFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
{
...
...
@@ -260,6 +259,35 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
}
}
// Decompress the airframe xml and save to file
success
=
_decompressJsonValue
(
px4Json
,
// JSON object
bytes
,
// Raw bytes of JSON document
"airframe_xml_size"
,
// key which holds byte size
"airframe_xml"
,
// key which holds compress bytes
decompressedBytes
);
// Returned decompressed bytes
if
(
success
)
{
// We cache the airframe xml in the same location as settings and parameters
QSettings
settings
;
QDir
airframeDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
QString
airframeFilename
=
airframeDir
.
filePath
(
"PX4AirframeFactMetaData.xml"
);
qDebug
()
<<
airframeFilename
;
QFile
airframeFile
(
airframeFilename
);
if
(
airframeFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
{
qint64
bytesWritten
=
airframeFile
.
write
(
decompressedBytes
);
if
(
bytesWritten
!=
decompressedBytes
.
count
())
{
// FIXME: What about these warnings?
emit
statusMessage
(
QString
(
"Write failed for airframe meta data file, error: %1"
).
arg
(
airframeFile
.
errorString
()));
airframeFile
.
close
();
QFile
::
remove
(
airframeFilename
);
}
else
{
airframeFile
.
close
();
}
}
else
{
emit
statusMessage
(
QString
(
"Unable to open airframe meta data file %1 for writing, error: %2"
).
arg
(
airframeFilename
).
arg
(
airframeFile
.
errorString
()));
}
}
// Decompress the image and save to file
_imageSize
=
px4Json
.
value
(
QString
(
"image_size"
)).
toInt
();
success
=
_decompressJsonValue
(
px4Json
,
// JSON object
...
...
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