-
Notifications
You must be signed in to change notification settings - Fork 3
Add offsets, example, fix acceleration. #2
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
Calibration math updated as per change requested in adafruit/Adafruit_CircuitPython_ADXL34x#34. |
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.
Just a few questions!
adafruit_adxl37x.py
Outdated
from typing import Tuple, Optional | ||
|
||
# This is only needed for typing | ||
import busio # pylint: disable=unused-import |
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.
Is the pylint
disable required? Looks like the library is used so it should be okay without it.
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 copied it from the other lib, I'll try running it without.
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.
It passes without it! I'll remove it, let me know what to with the type hint so I can do a single commit.
return x, y, z | ||
|
||
@property | ||
def range(self) -> int: |
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'm torn for what to do here. As is, it technically works, so the correct typing should be -> None
. Is the intention to allow for silently ignoring the lack of implementation, as opposed to raising NotImplementedError
?
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.
@tekktrik You're the expert here! I'll defer to you on this one. It throws the NotImplementedError
when attempting to use it, because you can't set the range on this chip.
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.
Hmmm.... if you want the behavior to be that it throws NotImplementedError
on both getting and setting, then I'd say it's fine to leave the typing as is because there's never really going to be a case where someone is expecting to get int
and actually gets anything at all, so the potentially future-safe implementation of returning int
seems fine. If you want the get functionality of range
to not fail but also not give anything useful, I would probably type this as returning None
. Either implementation works so up to 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.
I think we can leave it as it is for now then, and if it comes up in the future as an issue, we'll look at updating it!
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.
So is the decision to raise Not ImplementatedError
from this property getter as well?
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.
Looks good to me!
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADXL34x to 1.12.0 from 1.11.12: > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#34 from kattni/offset Updating https://github.com/adafruit/Adafruit_CircuitPython_ADXL37x to 1.1.0 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_ADXL37x#2 from kattni/offset Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 5.1.6 from 5.1.5: > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#84 from dhalbert/circuitpython_typing Updating https://github.com/adafruit/Adafruit_CircuitPython_Debug_I2C to 1.2.8 from 1.2.7: > Merge pull request adafruit/Adafruit_CircuitPython_Debug_I2C#12 from dhalbert/circuitpython-typing > Fixed readthedocs build
No description provided.