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
313ab9e5
Commit
313ab9e5
authored
Dec 23, 2018
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
1bf29d32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
QGCApplication.cc
src/QGCApplication.cc
+11
-0
FirmwareImage.cc
src/VehicleSetup/FirmwareImage.cc
+19
-11
FirmwareImage.h
src/VehicleSetup/FirmwareImage.h
+3
-0
No files found.
src/QGCApplication.cc
View file @
313ab9e5
...
...
@@ -236,11 +236,13 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
// Parse command line options
bool
fClearSettingsOptions
=
false
;
// Clear stored settings
bool
fClearCache
=
false
;
// Clear parameter/airframe caches
bool
logging
=
false
;
// Turn on logging
QString
loggingOptions
;
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--clear-settings"
,
&
fClearSettingsOptions
,
nullptr
},
{
"--clear-cache"
,
&
fClearCache
,
nullptr
},
{
"--logging"
,
&
logging
,
&
loggingOptions
},
{
"--fake-mobile"
,
&
_fakeMobile
,
nullptr
},
{
"--log-output"
,
&
_logOutput
,
nullptr
},
...
...
@@ -309,6 +311,15 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
}
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
if
(
fClearCache
)
{
QDir
dir
(
ParameterManager
::
parameterCacheDir
());
dir
.
removeRecursively
();
QFile
airframe
(
FirmwareImage
::
cachedAirframeMetaDataFile
());
airframe
.
remove
();
QFile
parameter
(
FirmwareImage
::
cachedParameterMetaDataFile
());
parameter
.
remove
();
}
// Set up our logging filters
QGCLoggingCategoryRegister
::
instance
()
->
setFilterRulesFromSettings
(
loggingOptions
);
...
...
src/VehicleSetup/FirmwareImage.cc
View file @
313ab9e5
...
...
@@ -215,6 +215,21 @@ bool FirmwareImage::isCompatible(uint32_t boardId, uint32_t firmwareId) {
return
result
;
}
QString
FirmwareImage
::
cachedParameterMetaDataFile
(
void
)
{
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
return
parameterDir
.
filePath
(
QStringLiteral
(
"ParameterFactMetaData.xml"
));
}
QString
FirmwareImage
::
cachedAirframeMetaDataFile
(
void
)
{
QSettings
settings
;
QDir
airframeDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
return
airframeDir
.
filePath
(
QStringLiteral
(
"PX4AirframeFactMetaData.xml"
));
}
bool
FirmwareImage
::
_px4Load
(
const
QString
&
imageFilename
)
{
_imageSize
=
0
;
...
...
@@ -275,12 +290,8 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
_jsonParamXmlKey
,
// key which holds compressed bytes
decompressedBytes
);
// Returned decompressed bytes
if
(
success
)
{
// Use settings location as our work directory, this way is something goes wrong the file is still there
// sitting next to the cache files.
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
QString
parameterFilename
=
parameterDir
.
filePath
(
"ParameterFactMetaData.xml"
);
QFile
parameterFile
(
parameterFilename
);
QString
parameterFilename
=
cachedParameterMetaDataFile
();
QFile
parameterFile
(
cachedParameterMetaDataFile
());
if
(
parameterFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
{
qint64
bytesWritten
=
parameterFile
.
write
(
decompressedBytes
);
...
...
@@ -306,12 +317,9 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
_jsonAirframeXmlKey
,
// key which holds compressed 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"
);
QString
airframeFilename
=
cachedAirframeMetaDataFile
();
//qDebug() << airframeFilename;
QFile
airframeFile
(
airframeFilename
);
QFile
airframeFile
(
cachedAirframeMetaDataFile
()
);
if
(
airframeFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
))
{
qint64
bytesWritten
=
airframeFile
.
write
(
decompressedBytes
);
...
...
src/VehicleSetup/FirmwareImage.h
View file @
313ab9e5
...
...
@@ -59,6 +59,9 @@ public:
/// @return true: actual boardId is compatible with firmware boardId
bool
isCompatible
(
uint32_t
boardId
,
uint32_t
firmwareId
);
static
QString
cachedParameterMetaDataFile
(
void
);
static
QString
cachedAirframeMetaDataFile
(
void
);
signals:
void
errorMessage
(
const
QString
&
errorString
);
void
statusMessage
(
const
QString
&
warningtring
);
...
...
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