-
Notifications
You must be signed in to change notification settings - Fork 18
gesture_proximity_threshold default causes prox value to lock at 51 #23
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
Comments
I do have this bug as well. How do I set the threshold to work around it? |
I tried to look into this, but I don't think I understand was the issue is. Can someone provide an example of what is wrong? |
The proximity reading is good as long as the detected distance is below the value of 50. Meaning it always returns back to 0 if the object (e.g. hand) is removed from the sensor. Once the value gets above 50 it gets "stuck" there, so does not return to 0. Basically it doesn't change at all (neither higher nor lower values). |
FYI - I have reproduced this. What I am seeing is that if I only enable proximity, then the setting of gesture_proximity_threshold does not matter. That is, the issue only occurs if I also enable gesture. I have not found a workaround at this time... still looking. |
I'm also experiencing this problem on a QT Py RP2040. I took a look at the datasheet: https://cdn.sparkfun.com/assets/learn_tutorials/3/2/1/Avago-APDS-9960-datasheet.pdf There are a number of relevant registers, I'm going to focus on ENABLE and GCONFIG4 Here's the ## GESTURE DETECTION
@property
def enable_gesture(self):
"""Gesture detection enable flag. True to enable, False to disable.
Note that when disabled, gesture mode is turned off"""
return self._gesture_enable
@enable_gesture.setter
def enable_gesture(self, enable_flag):
if not enable_flag:
self._gesture_mode = False
self._gesture_enable = enable_flag If you set The gesture state machine is on page 15 of the datasheet, and it implies that if _gesture_mode isn't cleared, the gesture state machine will loop forever |
I've seen this issue as well during my recent tesing. The use of the Here's the doc describing the
This only tells part of the story though. The Gesture Engine description includes a bit more detail on how GMODE is used internally.
Given how complicated the entry/exit of the gesture machine is it'll take some iterative testing to find the best defaults and how to expose the relevant settings effectively for things like But I don't think we should be writing to Once I've worked through quirks in the proximity system (which has some config items that are closely related to gesture) I'm hoping to get this figured out more definitively with some extensive testing. |
Spent a bunch of time today getting my head around the state machines and config registers in the APDS-9960. The datasheet is thorough enough but it takes a lot of reading, re-reading and tinkering to get it all figured out. This definitely not an intuitive sensor to work with, particularly the gesture engine. 😢 The root cause of this issue is the fact that the gesture engine gets stuck in an infinite loop. With this nested state machine looping, the overarching device-wide state machine never progresses to the next steps. That's why our This infinite looping happens because we haven't set There are a few potential fixes for this, like just setting a Thankfully I've got plenty of time this week to dive in. If all goes well I should have a PR up in a few days. I'm hoping to find an elegant fix but in the end a more substantial rewrite/modernization of |
Managed to get a good fix on options for making |
This has been resolved by #39 |
From @dastels in #16:
Related: gestures being triggered (prox > gesture_proximity_threshold) freeze the returned proximity value. E.g. if the threshold is at the default 50, the returned proximity value to 'lock in' when it reaches 51. Setting the threshold to 255 allows proximity to work property throughout it's full 0-255 range.
The text was updated successfully, but these errors were encountered: