Commit 8c7463e5 authored by Don Gagne's avatar Don Gagne

Merge pull request #2775 from DonLakeFlyer/FlashDisconnect

Flash auto-disconnect from vehicle
parents cacad2b2 e0997fa4
...@@ -97,6 +97,7 @@ Vehicle::Vehicle(LinkInterface* link, ...@@ -97,6 +97,7 @@ Vehicle::Vehicle(LinkInterface* link,
, _updateCount(0) , _updateCount(0)
, _rcRSSI(0) , _rcRSSI(0)
, _rcRSSIstore(100.0) , _rcRSSIstore(100.0)
, _autoDisconnect(false)
, _connectionLost(false) , _connectionLost(false)
, _connectionLostEnabled(true) , _connectionLostEnabled(true)
, _missionManager(NULL) , _missionManager(NULL)
...@@ -1316,6 +1317,9 @@ void Vehicle::_connectionLostTimeout(void) ...@@ -1316,6 +1317,9 @@ void Vehicle::_connectionLostTimeout(void)
_heardFrom = false; _heardFrom = false;
emit connectionLostChanged(true); emit connectionLostChanged(true);
_say(QString("connection lost to vehicle %1").arg(id()), GAudioOutput::AUDIO_SEVERITY_NOTICE); _say(QString("connection lost to vehicle %1").arg(id()), GAudioOutput::AUDIO_SEVERITY_NOTICE);
if (_autoDisconnect) {
disconnectInactiveVehicle();
}
} }
} }
......
...@@ -124,6 +124,7 @@ public: ...@@ -124,6 +124,7 @@ public:
Q_PROPERTY(uint messagesLost READ messagesLost NOTIFY messagesLostChanged) Q_PROPERTY(uint messagesLost READ messagesLost NOTIFY messagesLostChanged)
Q_PROPERTY(bool fixedWing READ fixedWing CONSTANT) Q_PROPERTY(bool fixedWing READ fixedWing CONSTANT)
Q_PROPERTY(bool multiRotor READ multiRotor CONSTANT) Q_PROPERTY(bool multiRotor READ multiRotor CONSTANT)
Q_PROPERTY(bool autoDisconnect MEMBER _autoDisconnect NOTIFY autoDisconnectChanged)
/// Resets link status counters /// Resets link status counters
Q_INVOKABLE void resetCounters (); Q_INVOKABLE void resetCounters ();
...@@ -318,6 +319,7 @@ signals: ...@@ -318,6 +319,7 @@ signals:
void missingParametersChanged(bool missingParameters); void missingParametersChanged(bool missingParameters);
void connectionLostChanged(bool connectionLost); void connectionLostChanged(bool connectionLost);
void connectionLostEnabledChanged(bool connectionLostEnabled); void connectionLostEnabledChanged(bool connectionLostEnabled);
void autoDisconnectChanged(bool autoDisconnectChanged);
void messagesReceivedChanged (); void messagesReceivedChanged ();
void messagesSentChanged (); void messagesSentChanged ();
...@@ -480,6 +482,7 @@ private: ...@@ -480,6 +482,7 @@ private:
QString _formatedMessage; QString _formatedMessage;
int _rcRSSI; int _rcRSSI;
double _rcRSSIstore; double _rcRSSIstore;
bool _autoDisconnect; ///< true: Automatically disconnect vehicle when last connection goes away or lost heartbeat
// Lost connection handling // Lost connection handling
bool _connectionLost; bool _connectionLost;
......
...@@ -43,7 +43,7 @@ QGCView { ...@@ -43,7 +43,7 @@ QGCView {
readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">" readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
readonly property string highlightSuffix: "</font>" readonly property string highlightSuffix: "</font>"
readonly property string welcomeText: "QGroundControl can upgrade the firmware on Pixhawk devices, 3DR Radios and PX4 Flow Smart Cameras." readonly property string welcomeText: "QGroundControl can upgrade the firmware on Pixhawk devices, 3DR Radios and PX4 Flow Smart Cameras."
readonly property string plugInText: highlightPrefix + "Plug in your device" + highlightSuffix + " via USB to " + highlightPrefix + "start" + highlightSuffix + " firmware upgrade. " readonly property string plugInText: "<big>" + highlightPrefix + "Plug in your device" + highlightSuffix + " via USB to " + highlightPrefix + "start" + highlightSuffix + " firmware upgrade.</big>"
readonly property string flashFailText: "If upgrade failed, make sure to connect " + highlightPrefix + "directly" + highlightSuffix + " to a powered USB port on your computer, not through a USB hub. " + readonly property string flashFailText: "If upgrade failed, make sure to connect " + highlightPrefix + "directly" + highlightSuffix + " to a powered USB port on your computer, not through a USB hub. " +
"Also make sure you are only powered via USB " + highlightPrefix + "not battery" + highlightSuffix + "." "Also make sure you are only powered via USB " + highlightPrefix + "not battery" + highlightSuffix + "."
readonly property string qgcUnplugText1: "All QGroundControl connections to vehicles must be " + highlightPrefix + " disconnected " + highlightSuffix + "prior to firmware upgrade." readonly property string qgcUnplugText1: "All QGroundControl connections to vehicles must be " + highlightPrefix + " disconnected " + highlightSuffix + "prior to firmware upgrade."
...@@ -58,7 +58,6 @@ QGCView { ...@@ -58,7 +58,6 @@ QGCView {
statusTextArea.append(highlightPrefix + "Upgrade cancelled" + highlightSuffix) statusTextArea.append(highlightPrefix + "Upgrade cancelled" + highlightSuffix)
statusTextArea.append("------------------------------------------") statusTextArea.append("------------------------------------------")
controller.cancel() controller.cancel()
flashCompleteWaitTimer.running = true
} }
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
...@@ -103,6 +102,7 @@ QGCView { ...@@ -103,6 +102,7 @@ QGCView {
// Board was found right away, so something is already plugged in before we've started upgrade // Board was found right away, so something is already plugged in before we've started upgrade
statusTextArea.append(qgcUnplugText1) statusTextArea.append(qgcUnplugText1)
statusTextArea.append(qgcUnplugText2) statusTextArea.append(qgcUnplugText2)
multiVehicleManager.activeVehicle.autoDisconnect = true
} else { } else {
// We end up here when we detect a board plugged in after we've started upgrade // We end up here when we detect a board plugged in after we've started upgrade
statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType) statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType)
...@@ -115,7 +115,6 @@ QGCView { ...@@ -115,7 +115,6 @@ QGCView {
onError: { onError: {
hideDialog() hideDialog()
statusTextArea.append(flashFailText) statusTextArea.append(flashFailText)
flashCompleteWaitTimer.running = true
} }
} }
...@@ -151,8 +150,8 @@ QGCView { ...@@ -151,8 +150,8 @@ QGCView {
} }
function reject() { function reject() {
cancelFlash()
hideDialog() hideDialog()
cancelFlash()
} }
ExclusiveGroup { ExclusiveGroup {
......
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