mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 02:13:34 +08:00
geofence: lock geofence items during a write transfers
- avoids race conditions when geofence data is updated in flight. During a transfer, the geofence module will not check for violations, which is done with the new dm_trylock method. - there is an update counter stored in dataman, and for each write transaction this is increased, so that the geofence module can reload the data upon data change (after it's unlocked). - single dm item updates are atomic already, so resetting the polygons to 0 does not need locking.
This commit is contained in:
@@ -127,6 +127,9 @@ private:
|
||||
int _mission_result_sub;
|
||||
orb_advert_t _offboard_mission_pub;
|
||||
|
||||
static uint16_t _geofence_update_counter;
|
||||
bool _geofence_locked; ///< if true, we currently hold the dm_lock for the geofence (transaction in progress)
|
||||
|
||||
MavlinkRateLimiter _slow_rate_limiter;
|
||||
|
||||
bool _verbose;
|
||||
@@ -236,4 +239,8 @@ private:
|
||||
int format_mavlink_mission_item(const struct mission_item_s *mission_item,
|
||||
mavlink_mission_item_t *mavlink_mission_item);
|
||||
|
||||
/**
|
||||
* set _state to idle (and do necessary cleanup)
|
||||
*/
|
||||
void switch_to_idle_state();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user