mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 01:13:35 +08:00
navigator: avoid use of a static variable last_geofence_check
This commit is contained in:
@@ -232,6 +232,8 @@ Navigator::run()
|
|||||||
/* rate-limit position subscription to 20 Hz / 50 ms */
|
/* rate-limit position subscription to 20 Hz / 50 ms */
|
||||||
orb_set_interval(_local_pos_sub, 50);
|
orb_set_interval(_local_pos_sub, 50);
|
||||||
|
|
||||||
|
hrt_abstime last_geofence_check = 0;
|
||||||
|
|
||||||
while (!should_exit()) {
|
while (!should_exit()) {
|
||||||
|
|
||||||
/* wait for up to 1000ms for data */
|
/* wait for up to 1000ms for data */
|
||||||
@@ -552,8 +554,6 @@ Navigator::run()
|
|||||||
check_traffic();
|
check_traffic();
|
||||||
|
|
||||||
/* Check geofence violation */
|
/* Check geofence violation */
|
||||||
static hrt_abstime last_geofence_check = 0;
|
|
||||||
|
|
||||||
if (have_geofence_position_data &&
|
if (have_geofence_position_data &&
|
||||||
(_geofence.getGeofenceAction() != geofence_result_s::GF_ACTION_NONE) &&
|
(_geofence.getGeofenceAction() != geofence_result_s::GF_ACTION_NONE) &&
|
||||||
(hrt_elapsed_time(&last_geofence_check) > GEOFENCE_CHECK_INTERVAL)) {
|
(hrt_elapsed_time(&last_geofence_check) > GEOFENCE_CHECK_INTERVAL)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user