-
Notifications
You must be signed in to change notification settings - Fork 10
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
updating lib #24
updating lib #24
Conversation
I've got hardware coming to try this out. |
YAY :). Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these improvements @jposada202020!
I tested this version successfully with a Feather ESP32S2-TFT.
I am in favor of two changes:
- I think we should implement a
high_resolution
property and setter to go along with it that allow the old API to work the same way it used toadt.high_resolution = True
oradt.high_resolution = False
will server has convenience properties for the new resolution_mode setter.
If we don't adopt this then we will need to change the simpletest script as well as existing code in the learn guide for the product and a handful of other learn projects that use this sensor.
I tested an implementation of this successfully:
@property
def high_resolution(self) -> bool:
return self.resolution_mode == "HIGH_RESOLUTION"
@high_resolution.setter
def high_resolution(self, new_val: bool):
if new_val:
self.resolution_mode = HIGH_RESOLUTION
else:
self.resolution_mode = LOW_RESOLUTION
- I think in general when there are getter and setter properties for a value it should be possible to pass the value from the getter back into the setter and have it be valid input. As it is now there are a few properties in this class that return strings like
"HIGH_RESOLUTION"
but have accompanying setters that are expecting constant values int likeadafruit_adt7410.HIGH_RESOLUTION
. I believe that the same values provided by the getter should be valid for the setter, so we could either:
- change the setter to accept strings such as
"HIGH_RESOLUTION"
which are returned by the getters. Or - change the getters to return the constants like
adafruit_adt7410.HIGH_RESOLUTION
instead of their string counterparts.
I can see a good case for both ways, but I think I'd lean toward having the setters accept strings since the strings are more helpful when they get printed out to the serial console with no additional logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented the requested changes with the latest commit and re-tested this with a sensor and a Feather ESP32-S2 TFT
Current version looks good to me.
Thanks again for the re-write @jposada202020!
Updating https://github.com/adafruit/Adafruit_CircuitPython_24LC32 to 1.1.0 from 1.0.12: > Merge pull request adafruit/Adafruit_CircuitPython_24LC32#23 from TonyLHansen/main Updating https://github.com/adafruit/Adafruit_CircuitPython_ADT7410 to 2.0.0 from 1.3.13: > Merge pull request adafruit/Adafruit_CircuitPython_ADT7410#24 from jposada202020/improving_lib Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 3.1.0 from 3.0.17: > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#61 from prcutler/root-group-fix Updating https://github.com/adafruit/Adafruit_CircuitPython_PCA9685 to 3.4.14 from 3.4.13: > Merge pull request adafruit/Adafruit_CircuitPython_PCA9685#59 from bdlucas1/main Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 5.8.1 from 5.8.0: > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#114 from kavinaidoo/main Updating https://github.com/adafruit/Adafruit_CircuitPython_asyncio to 1.3.0 from 1.2.2: > Merge pull request adafruit/Adafruit_CircuitPython_asyncio#59 from imnotjames/chore/optional-traceback Updating https://github.com/adafruit/Adafruit_CircuitPython_PyCamera to 0.0.7 from 0.0.6: > Merge pull request adafruit/Adafruit_CircuitPython_PyCamera#15 from adafruit/enhancements > Merge pull request adafruit/Adafruit_CircuitPython_PyCamera#13 from brentru/allow-jpg-save Updating https://github.com/adafruit/Adafruit_CircuitPython_TemplateEngine to 1.1.0 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_TemplateEngine#2 from michalpokusa/removing-8-x-x-re-module-bug-workarounds Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Completely rewrite the library to use register, and add more examples and operation_mode function. Finally, improved the documentation.
Tested in an old Adafruit ADT7410. (Without the Stemma QT connector)