Skip to content
Snippets Groups Projects
Commit 4c56994d authored by Julian Oes's avatar Julian Oes Committed by Daniel Agar
Browse files

mavlink_system: set update_counter for safe points

This variable was not set and lead to uninitialized memory being written
to dataman.
parent bf32ff32
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment