-
Notifications
You must be signed in to change notification settings - Fork 15
Update adafruit_debouncer.py #24
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
Testing if time.monotonic_ns() is really implemented. Supposed to solve #22 Works for me on PyPortal.
The test failure is an import issue "detected" by the documentation system. |
It's a happy coincidence that the documentation build caught this problem. 👍 The code to adapt to both `monotonic_ns` and `monotonic` is structured a bit differently than the LED animation library, which is not a problem. However, when monotonic_ns is not available, the line `time.monotonic_ns()` creates an AttributeError, so we need to catch that. Since there's no `import` inside this block, we do _NOT_ need to catch `ImportError`. At any rate, that's my quick analysis of what has occurred here. I did not do any testing. I think that if I'm correct it will fix the documentation building problem, as well as the functionality.
Thanks @dglaude ! It's a happy coincidence that the documentation build caught this problem. 👍 The code to adapt to both I think that if I'm correct it will fix the documentation building problem, as well as the functionality. Please give my updated version a test if possible. |
You are right, that fixed the documentation too. I tested, but for me it give the same result because on my hardware it raise NotImplementedError. To have a full coverage test it would need a platform/setup/config that:
I am pretty sure about (1) and (3). Not sure about AttributeError and how to get that. |
Isn't it a 5.3 board without long ints that raises AttributeError (or ImportError, if the name is not found by an 'import ... from' statement) and 6.0 raises NotImplementedError? |
To phrase it more positively, I think it is adequate to test with a matrix of 4 configurations, probably requiring two boards: 5.3 and 6; with and without long ints. |
So here are my result on a board with M0. Special version of the library with some print code:
Special test main.py code:
Result with 5.3.1 on Commander 8086 board:
Result with 6.0.0-alpha3+ on Commander 8086 board:
|
Ok, so tested on Itsy Bitsy M4 Express, both with a 5.3.0-rc0 and the latest "night build" and it give:
So I guess all the usecase are tested. |
Thank you for doing that additional testing. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 2.2.6 from 2.2.5: > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#35 from jerryneedell/jerryn_gesture Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.9.2 from 2.9.1: > Merge pull request adafruit/Adafruit_CircuitPython_SSD1306#51 from Wmyers559/update-example Updating https://github.com/adafruit/Adafruit_CircuitPython_Thermal_Printer to 1.3.0 from 1.2.3: > Merge pull request adafruit/Adafruit_CircuitPython_Thermal_Printer#20 from greg-elmi/master Updating https://github.com/adafruit/Adafruit_CircuitPython_VC0706 to 4.2.0 from 4.1.3: > Merge pull request adafruit/Adafruit_CircuitPython_VC0706#17 from Andon-A/resume_video Updating https://github.com/adafruit/Adafruit_CircuitPython_Debouncer to 1.3.6 from 1.3.5: > Merge pull request adafruit/Adafruit_CircuitPython_Debouncer#24 from dglaude/patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes to 2.0.1 from 2.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#24 from kmatch98/master
Testing if time.monotonic_ns() is really implemented.
Supposed to solve #22
Works for me on PyPortal.
(not parsed with black or pylint, just copy and paste from my version in Mu)