forked from Archive/PX4-Autopilot
mavlink timesync avoid unintended integer divide
- fixes Coverity CID 306260
This commit is contained in:
parent
a90c7659ad
commit
99b9eaea68
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue