ArduCopter: update reset counters when active backend changes

This commit is contained in:
Peter Barker
2026-07-15 08:07:55 +10:00
committed by Peter Barker
parent c963865390
commit 6164e08114
2 changed files with 5 additions and 6 deletions
+2 -2
View File
@@ -310,8 +310,8 @@ private:
#endif
// system time in milliseconds of last recorded yaw reset from ekf
uint32_t ekfYawReset_ms;
// old value of counter which increments when our yaw estimate is reset
uint16_t ahrs_yaw_reset_count;
// old value of counter which increments when our attitude estimate is reset
uint16_t attitude_reset_count;
+3 -4
View File
@@ -249,11 +249,10 @@ void Copter::check_ekf_reset()
{
// check for yaw reset
float yaw_angle_change_rad;
uint32_t new_ekfYawReset_ms = ahrs.getLastYawResetAngle(yaw_angle_change_rad);
if (new_ekfYawReset_ms != ekfYawReset_ms) {
const uint16_t new_yaw_reset_count = ahrs.get_yaw_reset_count(yaw_angle_change_rad);
if (new_yaw_reset_count != ahrs_yaw_reset_count) {
attitude_control->inertial_frame_reset();
ekfYawReset_ms = new_ekfYawReset_ms;
LOGGER_WRITE_EVENT(LogEvent::EKF_YAW_RESET);
ahrs_yaw_reset_count = new_yaw_reset_count;
}
// check for change in primary EKF, reset attitude target and log. AC_PosControl handles position target adjustment