Skip to content

Added shake detection #13

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 4 commits into from
Nov 27, 2017
Merged

Added shake detection #13

merged 4 commits into from
Nov 27, 2017

Conversation

kattni
Copy link
Contributor

@kattni kattni commented Nov 26, 2017

No description provided.

@tannewt tannewt self-requested a review November 27, 2017 03:11
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thanks for adding this! Two minor things.

anything less than 10 will erroneously report a constant
shake detected. (Default 30)
avg_delay - The speed in seconds at which the series of values used for the
average acceleration are taken. (Default 0.01)
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be clearer if this was total delay. That way its easy to tell how long it will take. Then, in the sleep just divide total delay by the number of samples.

"""
shake_accel = (0, 0, 0)
for i in range(avg_count):
shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
Copy link
Member

Choose a reason for hiding this comment

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

This is pretty tricky. How about adding a comment explaining how it works.

readings from acceleration. (Default 0.1)
"""
shake_accel = (0, 0, 0)
for i in range(avg_count):
Copy link
Member

Choose a reason for hiding this comment

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

Please put the internal explanation here after a #. The """ comment should only have the "public" info.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you thank you!

@tannewt tannewt merged commit 8a7d9d9 into adafruit:master Nov 27, 2017
tannewt pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 1, 2017
Updating https://github.com/adafruit/Adafruit_CircuitPython_DotStar to 1.1.3 from 1.1.2:
  > Add build tools into the requirements.
  > Configure Travis builds using circuitpython build tools.
  > Added import math
  > Updated neopixels to dostars in doc

Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH to v1.0.0 from 0.1.3:
  > Added shake detection (adafruit/Adafruit_CircuitPython_LIS3DH#13)
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.

2 participants