Skip to content
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

Wait longer after wakeup #30

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

FoamyGuy
Copy link
Contributor

@FoamyGuy FoamyGuy commented Nov 6, 2024

Intended to resolve #27

Updates the wait time after sending the wakeup command to 100ms which matches the current version of the arduino driver: https://github.com/adafruit/Adafruit_AM2320/blob/master/Adafruit_AM2320.cpp#L138

If I understand correctly it's not really possible to do the for loop retry logic which was added to the arduino driver here because our i2c.write() does not return a success flag to check for knowing when to loop. If I am mistaken and there is a way to do that and someone can point me in that direction I can update this with similar logic.

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

The i2c.write() retries once, and also in many ports has a one second timeout. But this seems like a good idea in any case.

@dhalbert
Copy link
Contributor

dhalbert commented Nov 6, 2024

You can catch the exception and re-try also, though the increased timeout may fix that. The exception I think is equivalent to the Arduino error code.

@FoamyGuy
Copy link
Contributor Author

FoamyGuy commented Nov 6, 2024

I have updated it with the latest commit to catch the exception and retry up to 3 times to match the logic in the arduino driver.

adafruit_am2320.py Outdated Show resolved Hide resolved
adafruit_am2320.py Outdated Show resolved Hide resolved
@FoamyGuy
Copy link
Contributor Author

FoamyGuy commented Nov 6, 2024

@dhalbert thank you! I've updated those to pass in the latest commit.

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

👍

@dhalbert dhalbert merged commit 636dbf2 into adafruit:main Nov 6, 2024
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 7, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_AD569x to 2.0.4 from 2.0.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_AD569x#4 from FoamyGuy/fix_circup_instruction

Updating https://github.com/adafruit/Adafruit_CircuitPython_AHTx0 to 1.0.23 from 1.0.22:
  > Merge pull request adafruit/Adafruit_CircuitPython_AHTx0#22 from FoamyGuy/busy_timeout_calibration

Updating https://github.com/adafruit/Adafruit_CircuitPython_AM2320 to 1.2.22 from 1.2.21:
  > Merge pull request adafruit/Adafruit_CircuitPython_AM2320#30 from FoamyGuy/wait_longer_after_wakeup

Updating https://github.com/adafruit/Adafruit_CircuitPython_BH1750 to 1.1.12 from 1.1.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_BH1750#11 from FoamyGuy/improve_docs

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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.

AM2315 OSError: [Errno 19] No such device
2 participants