You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the FIFO processing (and as far as I can tell), the library keeps reading the device to empty the FIFO, so instead of getting a full gesture it reads in fragments (one FIFO at a time), does some quick computation on the to give two values, and accumulates those values each time a new fragment comes in.
If you look at each reading in the FIFO as X for left/right and Y for up/down, the computation on a fragment determines the entry and exit positions by checking for the first and last XY values, ignoring those that are too close to (0,0).
There's no reason I can see (other than memory footprint) for processing each fragment separately, and it's possibly not ideal to use the first/last valid point in a fragment either. I suspect it's just to save memory and CPU cycles.
If you happen to be running on a chip with some clout, and some RAM, there will be much better solutions. You might for instance string all the fragments together to get a bunch of XY points, run a least-squares fit over the data to get a gradient and look at the ordering to get a direction for your vector.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Looking at the FIFO processing (and as far as I can tell), the library keeps reading the device to empty the FIFO, so instead of getting a full gesture it reads in fragments (one FIFO at a time), does some quick computation on the to give two values, and accumulates those values each time a new fragment comes in.
If you look at each reading in the FIFO as X for left/right and Y for up/down, the computation on a fragment determines the entry and exit positions by checking for the first and last XY values, ignoring those that are too close to (0,0).
There's no reason I can see (other than memory footprint) for processing each fragment separately, and it's possibly not ideal to use the first/last valid point in a fragment either. I suspect it's just to save memory and CPU cycles.
If you happen to be running on a chip with some clout, and some RAM, there will be much better solutions. You might for instance string all the fragments together to get a bunch of XY points, run a least-squares fit over the data to get a gradient and look at the ordering to get a direction for your vector.
Anyway, I'm taking a look at that now :-)
Beta Was this translation helpful? Give feedback.
All reactions