Unverified Commit 23b1190f authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7099 from DonLakeFlyer/Rover

Rover isFlying check fix
parents 87e63a9b 16d355df
......@@ -40,7 +40,7 @@ QGCView {
property bool _vehicleFlying: _activeVehicle ? _activeVehicle.flying : false
property bool _disableDueToArmed: vehicleComponent ? (!vehicleComponent.allowSetupWhileArmed && _vehicleArmed) : false
// FIXME: The _vehicleIsRover checkl is a hack to work around https://github.com/PX4/Firmware/issues/10969
property bool _disableDueToFlying: vehicleComponent ? (_vehicleIsRover || (!vehicleComponent.allowSetupWhileFlying && _vehicleFlying)) : false
property bool _disableDueToFlying: vehicleComponent ? (!_vehicleIsRover && !vehicleComponent.allowSetupWhileFlying && _vehicleFlying) : false
property string _disableReason: _disableDueToArmed ? qsTr("armed") : qsTr("flying")
property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
......
......@@ -89,6 +89,7 @@
#include "FactValueSliderListModel.h"
#include "ShapeFileHelper.h"
#include "QGCFileDownload.h"
#include "FirmwareImage.h"
#ifndef NO_SERIAL_LINK
#include "SerialLink.h"
......@@ -236,11 +237,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 +312,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(cachedAirframeMetaDataFile());
airframe.remove();
QFile parameter(cachedParameterMetaDataFile());
parameter.remove();
}
// Set up our logging filters
QGCLoggingCategoryRegister::instance()->setFilterRulesFromSettings(loggingOptions);
......@@ -839,3 +851,16 @@ void QGCApplication::_gpsNumSatellites(int numSatellites)
_gpsRtkFactGroup->numSatellites()->setRawValue(numSatellites);
}
QString QGCApplication::cachedParameterMetaDataFile(void)
{
QSettings settings;
QDir parameterDir = QFileInfo(settings.fileName()).dir();
return parameterDir.filePath(QStringLiteral("ParameterFactMetaData.xml"));
}
QString QGCApplication::cachedAirframeMetaDataFile(void)
{
QSettings settings;
QDir airframeDir = QFileInfo(settings.fileName()).dir();
return airframeDir.filePath(QStringLiteral("PX4AirframeFactMetaData.xml"));
}
......@@ -98,6 +98,9 @@ public:
FactGroup* gpsRtkFactGroup(void) { return _gpsRtkFactGroup; }
static QString cachedParameterMetaDataFile(void);
static QString cachedAirframeMetaDataFile(void);
public slots:
/// You can connect to this slot to show an information message box from a different thread.
void informationMessageBoxOnMainThread(const QString& title, const QString& msg);
......
......@@ -275,12 +275,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 = QGCApplication::cachedParameterMetaDataFile();
QFile parameterFile(QGCApplication::cachedParameterMetaDataFile());
if (parameterFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qint64 bytesWritten = parameterFile.write(decompressedBytes);
......@@ -306,12 +302,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 = QGCApplication::cachedAirframeMetaDataFile();
//qDebug() << airframeFilename;
QFile airframeFile(airframeFilename);
QFile airframeFile(QGCApplication::cachedAirframeMetaDataFile());
if (airframeFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qint64 bytesWritten = airframeFile.write(decompressedBytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment