-
Notifications
You must be signed in to change notification settings - Fork 71
allow easy configuration of single or double tapping #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is the sensitivity with single-tap. Same issue in the first demo example you sent me, I can't touch the board without setting it off. The threshold
, time_limit
and time_latency
values for double-tap are apparently wrong for single-tap. I've linked an example of a way to address this issue.
Is there a reason why you decided to do detect_taps
and tapped
vs. single_tap
and double_tap
? I wrote up the code to have single
and double
separate, and tested it. In that version, I am able to tweak the set_tap
values separately. It will take more testing to get it right, but here is what it looks like initially: https://github.com/kattni/Adafruit_CircuitPython_CircuitPlayground/blob/single-double-tap/adafruit_circuitplayground/express.py
My issue with having both single and double available are the same as before, that you can use single- and double-tap together (regardless of implementation type), and it returns mostly singletap. Seems like something we'd have to address in documentation or a guide so people aren't frustrated trying to use double-tap and single-tap together.
@@ -119,28 +119,53 @@ def __init__(self): | |||
self._lis3dh.range = adafruit_lis3dh.RANGE_8_G | |||
|
|||
# Initialise tap: | |||
self._last_tap = False | |||
self._detect_taps = 1 | |||
self.detect_taps = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is detect_taps included twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one is the setter (detect_taps) and one is the variable that is set by the setter (_detect_taps)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thank you!
try: | ||
self._lis3dh.set_tap(2, 18, time_limit=4, time_latency=17, time_window=110) | ||
self._lis3dh.set_tap(value, 18, time_limit=4, time_latency=17, time_window=110) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These numbers work for double-tapping, but it seems like they are not great for single-tap. Did you have issues with sensitivity? I can't touch the board without setting single-tap off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can tweak it for single/double, maybe set threshhold to 24 or so for single!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to set single-tap threshold to 70 with them separated before single-tap wasn't going off constantly. I'll test some numbers and get back to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure sounds good, yeah with 8G its hard to get good numbers!
It looks like 80 is a good threshold. When you said "tweak it for single/double" were you saying tweak the number in this implementation or did you want me to clean up the |
yah i mean checking if you want 1 or 2 at this line |
I'm still curious though, why detect_taps and tapped, rather than single_tap and double_tap? |
I'll commit it after the weekly :) |
zoOOOOOoooM! i think given you have to set up the filter differently, maybe less difficult to just say "hey you get single or double, your choice"? |
It doesn't look much different on the code end. The library sets everything up and the code is basically:
Even with detect_taps and tapped, you can do both, and it looks more like this:
Either way, double doesn't really work with single. So sticking with this: Do we want to try to put in something that makes it fail if you try to use it twice? Or deal with it in documentation? Or something different? (I had an issue with LIS3DH and 2 instances, but fixed that, it does work with |
Included fixes for travis ci build
I'd like to do some work on the documentation for these changes, update the explanations and add another example where you can delay between checking for single and double taps. I went straight to trying to use both in a tight loop, so I assume others might too. So I thought if we explain more clearly that it's single OR double, and also have an example of being able to use both with a delay between checking for single and double, that we'll catch that well enough. I'll merge this one and do another PR for the changes so I can work on them locally. Let me know if this works! |
I'm going to merge this PR and do the next set of updates locally. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground to 1.1.0 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#27 from kattni/tap-detect-update > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#26 from ladyada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH to 4.0.0 from 3.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_LIS3DH#19 from kattni/int-tapped-update
see below!