Skip to content

Propagate delay param from read() to analog_read() #90

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

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

todbot
Copy link
Contributor

@todbot todbot commented Dec 10, 2021

The seesaw.analog_read() function has a fixed time.sleep(0.001) in addition to the default time.sleep(0.008) in seesaw.read(). This PR removes that fixed delay, allows the user to specify the delay used in read(), and allows the delay to be specified in the creation of AnalogInput objects.

Tested by @jedgarpark where he was experiencing an accumulated >40 milliseconds of UI lag when reading four NeoSliders.

@todbot
Copy link
Contributor Author

todbot commented Dec 10, 2021

I don't understand what pre-commit is complaining about in the CI.
When I run black --check --target-version=py35 . locally I get:

% black --check --target-version=py35 .
All done! ✨ 🍰 ✨
13 files would be left unchanged.

@jedgarpark
Copy link
Contributor

I just tested this on a Feather RP2040 with four NeoSliders and a NeoKey 1x4 all over I2C. This new library improves the problem I have with latency, setting my analog read delay down to about 0.001 or 0.0005. No difference (nor problems) going lower than that.

@caternuson
Copy link
Contributor

This seems fine. The defaults retain the current timings, except for removing the 1ms delay that was probably safe guarding attempts to read too fast on the SAMD09 based boards. The reference guide mentions this requirement here:
https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout/analog-to-digital-converter
I think OK to remove and put that requirement on user to insure in their code.

And with this change, can override defaults for ATtiny817.

Would like @ladyada to take a look also though. Could be Reasons™ for these I'm not aware of.

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth a shot :)

@caternuson
Copy link
Contributor

thanks!

@caternuson caternuson merged commit f06ac21 into adafruit:main Dec 10, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 14, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.9.6 from 3.9.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_GPS#76 from mrdalgaard/main
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 6.1.0 from 6.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#116 from joebaird/main
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_Seesaw to 1.10.4 from 1.10.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#90 from todbot/main
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes to 2.4.1 from 2.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#45 from dhalbert/make-package

Updating https://github.com/adafruit/Adafruit_CircuitPython_RTTTL to 2.4.10 from 2.4.9:
  > Merge pull request adafruit/Adafruit_CircuitPython_RTTTL#29 from FoamyGuy/pyportal_fix

Updating https://github.com/adafruit/Adafruit_CircuitPython_TinyLoRa to 2.2.5 from 2.2.4:
  > update rtd py version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants