-
Notifications
You must be signed in to change notification settings - Fork 14
Initial working commit with I2C only #1
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
Thanks for the PR! I'm doing some code tests on this today and will do a review after the initial HW sanity checks. I did notice that the first sample is always The results being returned are most likely the previous buffered conversion request, so you might simply need a tiny delay between the read request and reading the device output the first time here (between the write that sends the request, and the read to retrieve it): c6c3a3d#diff-f32cde418fbcd2f8d3b666d82e153a17R203 UPDATE: You'll only see the |
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.
There are a few spacing and formatting issues, but this works great on my initial HW tests here, and I didn't spot anything in the core functions that would be problematic. You might want to run this through pylint or something similar, though, since the automated build system will reject anything that has warnings Good job on this, though, and thanks for the PR.
If you don't mind testing against pylint and fixing any issues, I'm happy to approve this. A quick run of pylint here gives me the following, for example:
$ pylint adafruit_adxl34x.py
************* Module adafruit_adxl34x
adafruit_adxl34x.py:54:33: C0326: Exactly one space required around assignment
_ADXL345_DEFAULT_ADDRESS =const(0x53) # Assumes ALT address pin low
^ (bad-whitespace)
adafruit_adxl34x.py:91:0: R0903: Too few public methods (0/1) (too-few-public-methods)
adafruit_adxl34x.py:130:0: R0903: Too few public methods (0/1) (too-few-public-methods)
------------------------------------------------------------------
Your code has been rated at 9.70/10 (previous run: 8.08/10, +1.62)
adafruit_adxl34x.py
Outdated
- ``DataRate.RATE_0_10_HZ`` | ||
|
||
""" | ||
RATE_3200_HZ = const(0b1111) # 1600Hz Bandwidth 140�A IDD |
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.
Presumably this should be mA?
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.
Yea, I thought it was just my terminal not rendering properly but I'll fix this.
.travis.yml
Outdated
- pip install --force-reinstall pylint==1.9.2 | ||
|
||
script: | ||
- pylint adafruit_max31856.py |
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.
This will need to be changed, missed it during the review sorry.
.travis.yml
Outdated
script: | ||
- pylint adafruit_max31856.py | ||
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py) | ||
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max31856 --library_location . |
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.
Same issue here (max31856
)
I committed, rebased and force pushed an update that corrects the things you mentioned but my local python environment is pretty fubared and I can't get pylint running even though it's installed. It should be passing pylint now but I'll check again when I get my environment sorted. |
D'oh! I recycled the hidden files because the cookiecutter didn't generate them (or I missed something). Should be fixed now. |
I still see a lot of warnings here, mostly about white space (image below), but these are from a different parser I'm using that checks against PEP8 style inside Atom. pylint seems happy, though, which should be enough for travis.ci. @kattni Are there specific requirements around PEP8, line spacing, etc. before this can be merged? |
@microbuilder So, in theory, if Pylint passes, we're happy with it. Personally I'd want some of those fixed up. Your linter seems to be ignoring the In the end though, as long as Travis is happy, the builds will succeed and that's the important part. |
29df12a
to
24d9de4
Compare
@caternuson I re-enabled whitespace complaints a bit lower than you requested because there were some additional lines that I wanted it disabled on. Travis looks to be passing again. |
I approved, but now realize a better way would be to add the enable where I said. For turning it off in your class Range: #pylint: disable=too-few-public-methods, bad-whitespace EDIT same for |
@caternuson I merged this in just to get something started, but feel free to raise an issue with any new suggestions? |
@microbuilder Thanks. Sounds good. It's mainly cosmetic linting issues at this point. Not worth holding up a release. |
This is to address adafruit/circuitpython#1198
I did notice one issue with the RTD build where the docs for the constructor doesn't understand how to get the value of a const I'm using for a default value and instead displays
class adafruit_adxl34x.ADXL345(i2c, address=<sphinx.ext.autodoc.importer._MockObject object>)
instead. If anyone knows how to fix this, please let me know. Making the variable in question not aconst
seems to work but I'd rather fix the docs than change the code.On thing I was thinking about was the enum-like classes for the
range
anddata_rate
values. Having to sayadafruit_adxl34x.Range.RANGE_2_G
seems repetitive but I can't just have the class variable named2G
. If anyone can think of a cleaner way to do this, I'm open to it.