PlanManager: fix mission download progress

By adding a member variable for the total mission item count, we can
actually correctly estimate the progress.
parent cdb4cdfd
......@@ -30,6 +30,7 @@ PlanManager::PlanManager(Vehicle* vehicle, MAV_MISSION_TYPE planType)
, _transactionInProgress(TransactionNone)
, _resumeMission(false)
, _lastMissionRequest(-1)
, _missionItemCountToRead(-1)
, _currentMissionIndex(-1)
, _lastCurrentIndex(-1)
{
......@@ -317,6 +318,7 @@ void PlanManager::_handleMissionCount(const mavlink_message_t& message)
for (int i=0; i<missionCount.count; i++) {
_itemIndicesToRead << i;
}
_missionItemCountToRead = missionCount.count;
_requestNextMissionItem();
}
}
......@@ -460,7 +462,7 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message, bool miss
return;
}
emit progressPct((double)seq / (double)_missionItems.count());
emit progressPct((double)seq / (double)_missionItemCountToRead);
_retryCount = 0;
if (_itemIndicesToRead.count() == 0) {
......
......@@ -144,6 +144,7 @@ protected:
QList<int> _itemIndicesToWrite; ///< List of mission items which still need to be written to vehicle
QList<int> _itemIndicesToRead; ///< List of mission items which still need to be requested from vehicle
int _lastMissionRequest; ///< Index of item last requested by MISSION_REQUEST
int _missionItemCountToRead;///< Count of all mission items to read
QList<MissionItem*> _missionItems; ///< Set of mission items on vehicle
QList<MissionItem*> _writeMissionItems; ///< Set of mission items currently being written to vehicle
......
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