Skip to content

Made members that store sensor data properties. Removed deprecated members. disabled members return none #38

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

Merged
merged 11 commits into from
Oct 18, 2019

Conversation

evaherrada
Copy link
Collaborator

@evaherrada evaherrada commented Oct 17, 2019

It's really late, and I haven't tested everything about this, but I don't anticipate anything major about the structure of the code changing if I find a little bug or two when I'm testing it. Fixes #37

@evaherrada evaherrada requested review from siddacious and a team October 17, 2019 05:37
@evaherrada
Copy link
Collaborator Author

Alright. Just tested this and everything seems to be working fine

@evaherrada evaherrada changed the title [Needs testing] Made members that store sensor data properties. Removed deprecated members. disabled members return none Made members that store sensor data properties. Removed deprecated members. disabled members return none Oct 17, 2019
"""Gives the raw accelerometer readings, in m/s."""
if self.mode not in [0, 2, 3, 6]:
return self._acceleration
return (None, None, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also update the docstrings of the mode property and the new properties that may return None to describe the new behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't change anything in the mode property, so I'm not really sure what I'd change on that docstring, but I'll do the docstrings for the new properties

Copy link
Contributor

Choose a reason for hiding this comment

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

The docstrings in the individual properties are great. All I would do for the mode property is to add a legend at the top of the table to describe what each symbol in the table means (x=on, -=off and will return an empty tuple)

@property
def acceleration(self):
"""Gives the raw accelerometer readings, in m/s."""
if self.mode not in [0, 2, 3, 6]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Here I would use the _MODE consts to make it more clear when and why the decision to return None is being made

@evaherrada
Copy link
Collaborator Author

@siddacious Does this look good? I wasn't really sure what to do about the mode property's docstring.

@evaherrada evaherrada requested a review from siddacious October 17, 2019 19:42
@siddacious
Copy link
Contributor

So close! Just fix the whitespace issue that pylint is complaining about and we're good to go

@siddacious siddacious merged commit e43b1a2 into adafruit:master Oct 18, 2019
@caternuson
Copy link
Contributor

Oops. Too late. FWIW - the lists could've been tuples. Ex:

if self.mode not in (0, 2, 3, 6):

@evaherrada
Copy link
Collaborator Author

I’ll make sure to change that before I make the next release for this library

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Oct 20, 2019
Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO055 to 4.0.0 from 3.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#38 from dherrada/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_EPD to 2.4.2 from 2.4.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_EPD#31 from makermelissa/master
  > Merge pull request adafruit/Adafruit_CircuitPython_EPD#28 from ladyada/master
  > Merge pull request adafruit/Adafruit_CircuitPython_EPD#27 from ladyada/master
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.

sensor.euler,quaternion,gyro, etc. returns 0 instead of None when those sensors are disabled
3 participants