From ae09ca36f30adf3b5b969772edd8632374309cc9 Mon Sep 17 00:00:00 2001 From: DoinLakeFlyer Date: Thu, 20 Feb 2020 14:11:28 -0800 Subject: [PATCH 1/2] Cleanup download object on error --- src/FirmwarePlugin/FirmwarePlugin.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc index 5f57fca..88e82a6 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.cc +++ b/src/FirmwarePlugin/FirmwarePlugin.cc @@ -824,6 +824,14 @@ void FirmwarePlugin::checkIfIsLatestStable(Vehicle* vehicle) _versionFileDownloadFinished(remoteFile, localFile, vehicle); sender()->deleteLater(); }); + connect( + downloader, + &QGCFileDownload::error, + this, + [=](QString errorMsg) { + qCDebug(FirmwarePluginLog) << "Failed to download the latest fw version file. Error: " << errorMsg; + downloader->deleteLater(); + }); downloader->download(versionFile); } From c0d503f3be066598926a71679527d89638e1410d Mon Sep 17 00:00:00 2001 From: DoinLakeFlyer Date: Thu, 20 Feb 2020 14:11:43 -0800 Subject: [PATCH 2/2] Only check latest stable firmware one time --- src/Vehicle/Vehicle.cc | 3 ++- src/Vehicle/Vehicle.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 794bbdf..6b8b623 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1343,7 +1343,8 @@ void Vehicle::_handleAutopilotVersion(LinkInterface *link, mavlink_message_t& me nullStr[8] = 0; _gitHash = nullStr; } - if (_toolbox->corePlugin()->options()->checkFirmwareVersion()) { + if (_toolbox->corePlugin()->options()->checkFirmwareVersion() && !_checkLatestStableFWDone) { + _checkLatestStableFWDone = true; _firmwarePlugin->checkIfIsLatestStable(this); } emit gitHashChanged(_gitHash); diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index b124d80..7b56c07 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -1504,6 +1504,7 @@ private: bool _isROIEnabled = false; Joystick* _activeJoystick = nullptr; + bool _checkLatestStableFWDone = false; int _firmwareMajorVersion; int _firmwareMinorVersion; int _firmwarePatchVersion;