summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-31 09:41:10 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-09-01 21:18:07 +0200
commit34e37fc3bcb136063cd25bc3ab124cb78644e39b (patch)
tree93fee36b49ec4953e0dcadf626a0ab1feb85d9f1
parent84366d8e709861e497179ac8ae2126b25d37d5a4 (diff)
Do not compute velocity until enough data is available
The first few ticks since a configuration change are not really suited for velocity computation, so move the speed computation over to the periodic sampling point. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--src/grail-gestures.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/grail-gestures.c b/src/grail-gestures.c
index a50ddca..4bd83b3 100644
--- a/src/grail-gestures.c
+++ b/src/grail-gestures.c
@@ -120,9 +120,9 @@ static void move_update(struct move_model *m, int i, float x, grail_time_t t)
120 float dt = t - fm->sample_ms; 120 float dt = t - fm->sample_ms;
121 fm->raw_delta = x - fm->value; 121 fm->raw_delta = x - fm->value;
122 fm->action_delta = fm->raw_delta; 122 fm->action_delta = fm->raw_delta;
123 fm->velocity = dt > EPS ? (x - fm->sample) / dt : 0;
124 fm->value = x; 123 fm->value = x;
125 if (dt > SAMPLE_MS) { 124 if (dt > SAMPLE_MS) {
125 fm->velocity = (x - fm->sample) / dt;
126 fm->sample = x; 126 fm->sample = x;
127 fm->sample_ms = t; 127 fm->sample_ms = t;
128 } 128 }