Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
f606cdda
Commit
f606cdda
authored
Feb 07, 2016
by
Don Gagne
Browse files
clear setting clears cached files
parent
34ee1349
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc
View file @
f606cdda
...
...
@@ -46,10 +46,17 @@ PX4AirframeLoader::PX4AirframeLoader(AutoPilotPlugin* autopilot, UASInterface* u
Q_ASSERT
(
uas
);
}
QString
PX4AirframeLoader
::
aiframeMetaDataFile
(
void
)
{
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
return
parameterDir
.
filePath
(
"PX4AirframeFactMetaData.xml"
);
}
/// Load Airframe Fact meta data
///
/// The meta data comes from firmware airframes.xml file.
void
PX4AirframeLoader
::
loadAirframe
Fact
MetaData
(
void
)
void
PX4AirframeLoader
::
loadAirframeMetaData
(
void
)
{
if
(
_airframeMetaDataLoaded
)
{
return
;
...
...
@@ -64,9 +71,7 @@ void PX4AirframeLoader::loadAirframeFactMetaData(void)
// We want unit test builds to always use the resource based meta data to provide repeatable results
if
(
!
qgcApp
()
->
runningUnitTests
())
{
// First look for meta data that comes from a firmware download. Fall back to resource if not there.
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
airframeFilename
=
parameterDir
.
filePath
(
"PX4AirframeFactMetaData.xml"
);
airframeFilename
=
aiframeMetaDataFile
();
}
if
(
airframeFilename
.
isEmpty
()
||
!
QFile
(
airframeFilename
).
exists
())
{
airframeFilename
=
":/AutoPilotPlugins/PX4/AirframeFactMetaData.xml"
;
...
...
src/AutoPilotPlugins/PX4/PX4AirframeLoader.h
View file @
f606cdda
...
...
@@ -49,7 +49,10 @@ public:
/// @param uas Uas which this set of facts is associated with
PX4AirframeLoader
(
AutoPilotPlugin
*
autpilot
,
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
static
void
loadAirframeFactMetaData
(
void
);
static
void
loadAirframeMetaData
(
void
);
/// @return Location of PX4 airframe fact meta data file
static
QString
aiframeMetaDataFile
(
void
);
private:
enum
{
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
f606cdda
...
...
@@ -81,7 +81,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) :
_airframeFacts
=
new
PX4AirframeLoader
(
this
,
_vehicle
->
uas
(),
this
);
Q_CHECK_PTR
(
_airframeFacts
);
PX4AirframeLoader
::
loadAirframe
Fact
MetaData
();
PX4AirframeLoader
::
loadAirframeMetaData
();
}
PX4AutoPilotPlugin
::~
PX4AutoPilotPlugin
()
...
...
src/FactSystem/ParameterLoader.cc
View file @
f606cdda
...
...
@@ -620,13 +620,18 @@ void ParameterLoader::_writeLocalParamCache()
ds
<<
cache_map
;
}
QString
ParameterLoader
::
parameterCacheFile
(
void
)
{
const
QDir
settingsDir
(
QFileInfo
(
QSettings
().
fileName
()).
dir
());
return
settingsDir
.
filePath
(
"param_cache"
);
}
void
ParameterLoader
::
_tryCacheHashLoad
(
int
uasId
,
QVariant
hash_value
)
{
uint32_t
crc32_value
=
0
;
/* The datastructure of the cache table */
QMap
<
int
,
MapID2NamedParam
>
cache_map
;
const
QDir
settingsDir
(
QFileInfo
(
QSettings
().
fileName
()).
dir
());
QFile
cache_file
(
settingsDir
.
filePath
(
"param_cache"
));
QFile
cache_file
(
parameterCacheFile
());
if
(
!
cache_file
.
exists
())
{
/* no local cache, immediately refresh all params */
refreshAllParameters
();
...
...
src/FactSystem/ParameterLoader.h
View file @
f606cdda
...
...
@@ -52,6 +52,9 @@ public:
ParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
~
ParameterLoader
();
/// @return Location of parameter cache file
static
QString
parameterCacheFile
(
void
);
/// Returns true if the full set of facts are ready
bool
parametersAreReady
(
void
)
{
return
_parametersReady
;
}
...
...
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
View file @
f606cdda
...
...
@@ -78,6 +78,13 @@ QVariant PX4ParameterMetaData::_stringToTypedVariant(const QString& string, Fact
return
var
;
}
QString
PX4ParameterMetaData
::
parameterMetaDataFile
(
void
)
{
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
return
parameterDir
.
filePath
(
"PX4ParameterFactMetaData.xml"
);
}
/// Load Parameter Fact meta data
///
/// The meta data comes from firmware parameters.xml file.
...
...
@@ -97,9 +104,7 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
// We want unit test builds to always use the resource based meta data to provide repeatable results
if
(
!
qgcApp
()
->
runningUnitTests
())
{
// First look for meta data that comes from a firmware download. Fall back to resource if not there.
QSettings
settings
;
QDir
parameterDir
=
QFileInfo
(
settings
.
fileName
()).
dir
();
parameterFilename
=
parameterDir
.
filePath
(
"PX4ParameterFactMetaData.xml"
);
parameterFilename
=
parameterMetaDataFile
();
}
if
(
parameterFilename
.
isEmpty
()
||
!
QFile
(
parameterFilename
).
exists
())
{
parameterFilename
=
":/AutoPilotPlugins/PX4/ParameterFactMetaData.xml"
;
...
...
src/FirmwarePlugin/PX4/PX4ParameterMetaData.h
View file @
f606cdda
...
...
@@ -49,6 +49,9 @@ public:
void
addMetaDataToFact
(
Fact
*
fact
,
MAV_TYPE
vehicleType
);
/// @return Location of PX4 parameter meta data file
static
QString
parameterMetaDataFile
(
void
);
private:
enum
{
XmlStateNone
,
...
...
src/QGCApplication.cc
View file @
f606cdda
...
...
@@ -97,6 +97,7 @@
#include
"VideoSurface.h"
#include
"VideoReceiver.h"
#include
"LogDownloadController.h"
#include
"PX4AirframeLoader.h"
#ifndef __ios__
#include
"SerialLink.h"
...
...
@@ -365,8 +366,13 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
if
(
fClearSettingsOptions
)
{
// User requested settings to be cleared on command line
settings
.
clear
();
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
QFile
::
remove
(
PX4AirframeLoader
::
aiframeMetaDataFile
());
QFile
::
remove
(
PX4ParameterMetaData
::
parameterMetaDataFile
());
QFile
::
remove
(
ParameterLoader
::
parameterCacheFile
());
}
_defaultMapPosition
.
setLatitude
(
settings
.
value
(
_defaultMapPositionLatKey
,
37.803784
).
toDouble
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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