diff --git a/libraries/AP_Compass/Compass_learn.cpp b/libraries/AP_Compass/Compass_learn.cpp index b9d142c8b0..e93cafdadc 100644 --- a/libraries/AP_Compass/Compass_learn.cpp +++ b/libraries/AP_Compass/Compass_learn.cpp @@ -164,7 +164,9 @@ void CompassLearn::update(void) sample_available = false; num_samples = 0; have_earth_field = false; - memset(predicted_offsets, 0, sizeof(predicted_offsets)); + for (auto &v : predicted_offsets) { + v.zero(); + } worst_error = 0; best_error = 0; best_yaw_deg = 0;