Unverified Commit a59f2282 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #6292 from mavlink/logdenied

Don't try to start logging if it's been denied.
parents 3fae6644 be9b4d3d
...@@ -309,6 +309,7 @@ MAVLinkLogManager::MAVLinkLogManager(QGCApplication* app, QGCToolbox* toolbox) ...@@ -309,6 +309,7 @@ MAVLinkLogManager::MAVLinkLogManager(QGCApplication* app, QGCToolbox* toolbox)
, _deleteAfterUpload(false) , _deleteAfterUpload(false)
, _windSpeed(-1) , _windSpeed(-1)
, _publicLog(false) , _publicLog(false)
, _logginDenied(false)
{ {
//-- Get saved settings //-- Get saved settings
QSettings settings; QSettings settings;
...@@ -613,7 +614,7 @@ MAVLinkLogManager::cancelUpload() ...@@ -613,7 +614,7 @@ MAVLinkLogManager::cancelUpload()
void void
MAVLinkLogManager::startLogging() MAVLinkLogManager::startLogging()
{ {
if(_vehicle && _vehicle->px4Firmware()) { if(_vehicle && _vehicle->px4Firmware() && !_logginDenied) {
if(_createNewLog()) { if(_createNewLog()) {
_vehicle->startMavlinkLog(); _vehicle->startMavlinkLog();
_logRunning = true; _logRunning = true;
...@@ -847,6 +848,8 @@ MAVLinkLogManager::_activeVehicleChanged(Vehicle* vehicle) ...@@ -847,6 +848,8 @@ MAVLinkLogManager::_activeVehicleChanged(Vehicle* vehicle)
// Connect new system // Connect new system
if(vehicle && vehicle->px4Firmware()) { if(vehicle && vehicle->px4Firmware()) {
_vehicle = vehicle; _vehicle = vehicle;
//-- Reset logging denied flag as well
_logginDenied = false;
connect(_vehicle, &Vehicle::armedChanged, this, &MAVLinkLogManager::_armedChanged); connect(_vehicle, &Vehicle::armedChanged, this, &MAVLinkLogManager::_armedChanged);
connect(_vehicle, &Vehicle::mavlinkLogData, this, &MAVLinkLogManager::_mavlinkLogData); connect(_vehicle, &Vehicle::mavlinkLogData, this, &MAVLinkLogManager::_mavlinkLogData);
connect(_vehicle, &Vehicle::mavCommandResult, this, &MAVLinkLogManager::_mavCommandResult); connect(_vehicle, &Vehicle::mavCommandResult, this, &MAVLinkLogManager::_mavCommandResult);
...@@ -888,7 +891,12 @@ MAVLinkLogManager::_mavCommandResult(int vehicleId, int component, int command, ...@@ -888,7 +891,12 @@ MAVLinkLogManager::_mavCommandResult(int vehicleId, int component, int command,
qCWarning(MAVLinkLogManagerLog) << "Stop MAVLink log command failed."; qCWarning(MAVLinkLogManagerLog) << "Stop MAVLink log command failed.";
} else { } else {
//-- Could not start logging for some reason. //-- Could not start logging for some reason.
qCWarning(MAVLinkLogManagerLog) << "Start MAVLink log command failed."; if(result == MAV_RESULT_DENIED) {
_logginDenied = true;
qCWarning(MAVLinkLogManagerLog) << "Start MAVLink log command denied.";
} else {
qCWarning(MAVLinkLogManagerLog) << "Start MAVLink log command failed.";
}
_discardLog(); _discardLog();
} }
} }
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
bool enableAutoStart () { return _enableAutoStart; } bool enableAutoStart () { return _enableAutoStart; }
bool uploading (); bool uploading ();
bool logRunning () { return _logRunning; } bool logRunning () { return _logRunning; }
bool canStartLog () { return _vehicle != NULL; } bool canStartLog () { return _vehicle != NULL && !_logginDenied; }
bool deleteAfterUpload () { return _deleteAfterUpload; } bool deleteAfterUpload () { return _deleteAfterUpload; }
bool publicLog () { return _publicLog; } bool publicLog () { return _publicLog; }
int windSpeed () { return _windSpeed; } int windSpeed () { return _windSpeed; }
...@@ -226,6 +226,7 @@ private: ...@@ -226,6 +226,7 @@ private:
QString _rating; QString _rating;
bool _publicLog; bool _publicLog;
QString _ulogExtension; QString _ulogExtension;
bool _logginDenied;
}; };
......
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