diff --git a/src/modules/mavlink/mavlink_timesync.cpp b/src/modules/mavlink/mavlink_timesync.cpp index 53ec811587..41c23a3068 100644 --- a/src/modules/mavlink/mavlink_timesync.cpp +++ b/src/modules/mavlink/mavlink_timesync.cpp @@ -107,7 +107,7 @@ MavlinkTimesync::handle_message(const mavlink_message_t *msg) // Filter gain scheduling if (!sync_converged()) { // Interpolate with a sigmoid function - double progress = _sequence / CONVERGENCE_WINDOW; + double progress = (double)_sequence / (double)CONVERGENCE_WINDOW; double p = 1.0 - exp(0.5 * (1.0 - 1.0 / (1.0 - progress))); _filter_alpha = p * ALPHA_GAIN_FINAL + (1.0 - p) * ALPHA_GAIN_INITIAL; _filter_beta = p * BETA_GAIN_FINAL + (1.0 - p) * BETA_GAIN_INITIAL;