diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-16 19:07:34 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-16 19:07:34 +0200 |
commit | 2908b6cc9dfa14ea1c0888dbf79776a2a1a02d87 (patch) | |
tree | 91128e3250f491af7c6b25d76e7654b976d74a5d | |
parent | 67778fef9fbaa62ab68a79e38567763bbd5b228c (diff) | |
parent | 28deb29d72809b009b83dd8365fbae3043684f14 (diff) |
Merge branch 'unstable' into trackhat
* unstable:
win32-shortcuts: drop null keycode
accela: drop NaN/+-inf values
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 4 | ||||
-rw-r--r-- | opentrack/shortcuts.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 84bd68c8..46c35958 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -88,7 +88,9 @@ void FTNoIR_Filter::filter(const double* input, double *output) { Map& m = i >= 3 ? rot : trans; - smoothed_input[i] = smoothed_input[i] * (1.-alpha) + input[i] * alpha; + const bool drop = std::isnan(input[i]) || std::isinf(input[i]); + const double f = drop ? last_output[i] : input[i]; + smoothed_input[i] = smoothed_input[i] * (1.-alpha) + f * alpha; const double in = smoothed_input[i]; diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h index 576b5384..63d91829 100644 --- a/opentrack/shortcuts.h +++ b/opentrack/shortcuts.h @@ -54,6 +54,8 @@ public: bool should_process() { + if (keycode == 0) + return false; bool ret = timer.elapsed_ms() > 100; timer.start(); return ret; |