mavlink_system: set update_counter for safe points

This variable was not set and lead to uninitialized memory being written
to dataman.
This commit is contained in:
Julian Oes
2019-04-24 11:15:43 -04:00
committed by Daniel Agar
parent bf32ff32f8
commit 4c56994d7a
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -62,6 +62,8 @@ int32_t MavlinkMissionManager::_current_seq = 0;
bool MavlinkMissionManager::_transfer_in_progress = false;
constexpr uint16_t MavlinkMissionManager::MAX_COUNT[];
uint16_t MavlinkMissionManager::_geofence_update_counter = 0;
uint16_t MavlinkMissionManager::_safepoint_update_counter = 0;
#define CHECK_SYSID_COMPID_MISSION(_msg) (_msg.target_system == mavlink_system.sysid && \
((_msg.target_component == mavlink_system.compid) || \
@@ -236,6 +238,7 @@ MavlinkMissionManager::update_safepoint_count(unsigned count)
{
mission_stats_entry_s stats;
stats.num_items = count;
stats.update_counter = ++_safepoint_update_counter;
/* update stats in dataman */
int res = dm_write(DM_KEY_SAFE_POINTS, 0, DM_PERSIST_POWER_ON_RESET, &stats, sizeof(mission_stats_entry_s));
+1
View File
@@ -130,6 +130,7 @@ private:
orb_advert_t _offboard_mission_pub{nullptr};
static uint16_t _geofence_update_counter;
static uint16_t _safepoint_update_counter;
bool _geofence_locked{false}; ///< if true, we currently hold the dm_lock for the geofence (transaction in progress)
MavlinkRateLimiter _slow_rate_limiter{100 * 1000}; ///< Rate limit sending of the current WP sequence to 10 Hz