diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-14 00:48:29 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-14 00:48:29 +0200 |
commit | df2dc4503ce9ca4276a32925cfac49a3f26c4985 (patch) | |
tree | 69d59c6e401e1b1e54e61be1a1d3be7219c13d68 | |
parent | ee18bc05ae54bd4b9a959ef544181dd8f597d955 (diff) |
partial revert of 74d9f5e31428ef362033a63c10b781d943c5e5a5
We actually need to use a float intermediate type lest the value gets
truncated.
-rw-r--r-- | filter-ewma2/ftnoir_filter_ewma2.cpp | 2 | ||||
-rw-r--r-- | filter-kalman/kalman.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/filter-ewma2/ftnoir_filter_ewma2.cpp b/filter-ewma2/ftnoir_filter_ewma2.cpp index 6f9e428c..bf4b1083 100644 --- a/filter-ewma2/ftnoir_filter_ewma2.cpp +++ b/filter-ewma2/ftnoir_filter_ewma2.cpp @@ -49,7 +49,7 @@ void FTNoIR_Filter::filter(const double *input, double *output) } } // Get the time in seconds since last run and restart the timer. - const double dt = timer.restart() / 1000; + const double dt = timer.restart() / 1000.; // Calculate delta_alpha and noise_alpha from dt. double delta_alpha = dt/(dt + delta_RC); double noise_alpha = dt/(dt + noise_RC); diff --git a/filter-kalman/kalman.cpp b/filter-kalman/kalman.cpp index 0e7537d1..5af548ed 100644 --- a/filter-kalman/kalman.cpp +++ b/filter-kalman/kalman.cpp @@ -80,7 +80,7 @@ void FTNoIR_Filter::filter(const double* input, double *output) if (!timer.isValid()) timer.start(); // Get the time in seconds since last run and restart the timer. - const double dt = timer.restart() / 1000; + const double dt = timer.restart() / 1000.; // Note this is a terrible way to detect when there is a new // frame of tracker input, but it is the best we have. bool new_input = false; |