diff --git a/EKF/control.cpp b/EKF/control.cpp index a5596fbd77..d2ceafb9a6 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -151,6 +151,8 @@ void Ekf::controlFusionModes() _control_status.flags.wind = false; } + // Store the status to enable change detection + _control_status_prev.value = _control_status.value; } void Ekf::calculateVehicleStatus() diff --git a/EKF/ekf.h b/EKF/ekf.h index de693135e9..a7a426463a 100644 --- a/EKF/ekf.h +++ b/EKF/ekf.h @@ -85,8 +85,12 @@ public: bool collect_gps(uint64_t time_usec, struct gps_message *gps); bool collect_imu(imuSample &imu); + // this is the current status of the filter control modes filter_control_status_u _control_status = {}; + // this is the previous status of the filter control modes - used to detect mode transitions + filter_control_status_u _control_status_prev = {}; + // get the ekf WGS-84 origin position and height and the system time it was last set void get_ekf_origin(uint64_t *origin_time, map_projection_reference_s *origin_pos, float *origin_alt);