Skip to content

Encoder: do kernel check, PEP8 cleanup #201

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 2 commits into from
Nov 25, 2017
Merged

Encoder: do kernel check, PEP8 cleanup #201

merged 2 commits into from
Nov 25, 2017

Conversation

dplanella
Copy link
Contributor

  • Added a check for kernels >= 4.4
  • Cleaned up formatting for the module to be PEP8-compliant

While the diff is quite big, the change is minimal (added kernel check). I've changed all indentations to 4 spaces, removed trailing whitespace, etc. to make the module PEP8-compliant. I thought it had to be done before further additions to the module, so now is probably a good time as any :)

To double-check no further changes were introduced, the diff can be done with an external tool filtering out the whitespace changes.

- Added a check for kernels >= 4.4
- Cleaned up formatting for the module to be PEP8-compliant
@pdp7 pdp7 self-assigned this Nov 25, 2017
@pdp7
Copy link
Collaborator

pdp7 commented Nov 25, 2017

thanks @dplanella

@pdp7 pdp7 closed this Nov 25, 2017
@pdp7 pdp7 reopened this Nov 25, 2017
@pdp7 pdp7 merged commit 696c949 into adafruit:master Nov 25, 2017
@pdp7
Copy link
Collaborator

pdp7 commented Nov 25, 2017

#201 has been merged. Thanks.

@pdp7
Copy link
Collaborator

pdp7 commented Nov 25, 2017

@dplanella fyi - the logic for the kernel check does not seem to be correct.

The ImportError message states Encoder module requires Linux kernel version >= 4.4.x but code is checking exactly for 4.4. It throws an error for any version great than 4.4 such as 4.14.

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ python -c 'import Adafruit_BBIO.Encoder'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "Adafruit_BBIO/Encoder.py", line 13, in <module>
    'Your Linux kernel version is {}.'.format(platform.release()))
ImportError: The Encoder module requires Linux kernel version >= 4.4.x.
Please upgrade your kernel to use this module.
Your Linux kernel version is 4.14.0-ti-r9.

@dplanella
Copy link
Contributor Author

@pdp7 apologies, I can see where it went wrong. Fixed now on PR #202.

@dplanella dplanella deleted the encoder-cleanup branch November 25, 2017 19:03
pdp7 added a commit that referenced this pull request Dec 1, 2017
Features:
  * Issue #194: Encoder position cannot be set
  * PR #205: Encoder: add support for reading/writing sysfs attributes

Fixes:
  * Issue #198: use https for DEFAULT_URL in distribute_setup.py
  * Issue #197: Fix leak of pwm enable file descriptor
  * Issue #189: Fix seg fault of PWM in Python 3.6
  * Issue #180: Clarify there is no 0 prefix for pin lables
  * PR #201: Encoder: do kernel check, PEP8 cleanup
  * PR #202: Encoder: corrected kernel check logic
  * PR #207: Encoder: improved usage adocumentation
  * PR #210: Encoder: fix sysfs import, make code Python 3 compatible
  * PR #212: Encoder: fix Python 3 compatibility
  * PR #213: Encoder: fix frequency calculation from period

shortlog:

* David Planella (18):
  * Encoder: initialize only the given channel
  * Sync from master
  * Encoder: do kernel check, PEP8 cleanup
  * Encoder: added sysfs module
  * Encoder: use sysfs to write QEP attributes
  * Encoder: corrected kernel check logic
  * Merge pull request #2 from adafruit/master
  * Encoder: convert get/set methods to properties, update apidoc strings
  * Encoder: updated README
  * Encoder: add README apt install clarification
  * Encoder: copyright assignment note, updated comments
  * Encoder: added usage notes
  * Encoder: improved usage documentation
  * Encoder: minor fix to usage example
  * Encoder: added a note about permissions
  * Encoder: switched sysfs to be a relative import compatible with Python 2 and 3
  * Encoder: use items() instead of iteritems() to be Python 3 compatible
  * Encoder: fix frequency getter

* Drew Fustini (18):
  * use https for DEFAULT_URL in distribute_setup.py (#198)
  * fix except syntax for Python 3
  * use dict.items() instead of dict.iteritems() for Python 3
  * fix error in set_brightness()
  * close enable_fd when stopping PWM output (#197)
  * Merge pull request #199 from dplanella/patch-1
  * Fix leak of pwm enable file descriptor (#197)
  * Merge pull request #201 from dplanella/encoder-cleanup
  * remove test_rotary.py as not valid for pytest
  * Fix seg fault of PWM in Python 3.6 (#189)
  * Merge pull request #202 from dplanella/patch-2
  * Clarify there is no 0 prefix for pin lables (#180)
  * Merge pull request #205 from dplanella/encoder-sysfs
  * assign copyright for new file to Adafruit Industries
  * Add bash scripts to help install and test
  * Merge pull request #212 from dplanella/patch-4
  * Merge pull request #207 from dplanella/patch-3
  * Merge pull request #213 from dplanella/fix-encoder-frequency

Signed-off-by: Drew Fustini <drew@pdp7.com>
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy