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

Add error checking and retries to the read and write functions #27

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ilikecake
Copy link

I am having issues with read errors on

Adafruit CircuitPython 9.2.1 on 2024-11-20; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3

See here for more details.

I added try/except and retry to the _read_word and _write_word functions. I also added a check to the cell_voltage, cell_percent, and cell_temperature functions that will catch an error in a read during those functions and return none if the read fails. It will be up to the user to decide what they want to do when that happens, but it won't crash user code. (probably)

My experiences with these errors:

  • The errors happen more often the more quickly you read data from the device. (as in how fast you call the cell_voltage function.)
  • Most of these error are cleared up with a single retry.
  • It will occasionally fail 10 times in a row, so the added try/except in the read functions is necessary.

Possible Improvements:

  • Allow the user to set the number of retries.
  • Add try/except to other functions.

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.

1 participant