Skip to content

Turn off RotaryEncoder's debug output by default #191

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

Closed
dplanella opened this issue Nov 14, 2017 · 5 comments
Closed

Turn off RotaryEncoder's debug output by default #191

dplanella opened this issue Nov 14, 2017 · 5 comments
Assignees

Comments

@dplanella
Copy link
Contributor

I'm using a rotary encoder based on the KY-040 module, with the Adafruit_BBIO.Encoder.RotaryEncoder class. I'm running the latest IoT Debian image on a Beaglebone Black:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.2 (stretch)
Release:	9.2
Codename:	stretch
$ uname -r
4.4.91-ti-r133
$ python --version
Python 2.7.13

To enable the QEP module on the hardware, I added these lines to /boot/uEnv.txt as instructed in the Encoder module source code and rebooted:

cmdline=coherent_pool=1M quiet cape_universal=enable
cape_enable=bone_capemgr.enable_partno=cape-universala

I then configured the equep2 pins on the command line:

$ config-pin P8.11 qep 
$ config-pin P8.12 qep 

And with these inputs connected to the encoder, I ran this simple code via an SSH connection:

import time
import Adafruit_BBIO.Encoder as Encoder

encoder = Encoder.RotaryEncoder(Encoder.RotaryEncoder.EQEP2)

encoder.setAbsolute()
encoder.zero()

while True:
    print("Encoder position: " + encoder.getPosition())
    time.sleep(1)
  • Expected: the position is printed on screen every second
  • Actual: the position is printed on screen every second (yay!), but the output is obscured by a wealth of debug messages.

In summary, I would expect debug info not to be printed on a production library, unless explicitly enabled. Or in other words, can the debug output be turned off by default?

Thanks!

@pdp7
Copy link
Collaborator

pdp7 commented Nov 15, 2017

@dplanella thanks for the feedback, I'll eliminate that debug logging

@dplanella
Copy link
Contributor Author

@pdp7 no worries, I went ahead and submitted pull #195 to fix this. I'd appreciate a review and hopefully we can then close the issue.

@pdp7
Copy link
Collaborator

pdp7 commented Nov 17, 2017

@dplanella thanks!

@pdp7
Copy link
Collaborator

pdp7 commented Nov 17, 2017

I've merged #195

@pdp7 pdp7 closed this as completed Nov 17, 2017
@dplanella
Copy link
Contributor Author

Excellent, thanks!

pdp7 added a commit that referenced this issue Nov 19, 2017
Release 1.0.8:
==============
Fixes:
  Issue #196: cache board type to avoid poor performance
  Issue #192: fix PocketBeagle PWM pin typo
  Issue #191: turn off RotaryEncoder's debug output by default
  Issue #188: GPIO is extremely slow (20ms to toggle)
  Issue #186: problems with UART

shortlog:

David Planella (12):
  Copy Encoder module comments to README.md
  Formatted Encoder README in markdown
  Fixed Encoder README formatting
  Removed QEP instructions from Encoder module
  Fixes to Encoder README
  Updated Encoder README
  Encoder README: added info on dedicated overlays
  Encoder README: updated info on pre-requisites
  Encoder README update
  Encoder README update
  Add logging support, turn off unconditional debug output
  Encoder: remove unused logging code

Drew Fustini (3):
  Merge pull request #195 from dplanella/master
  Fix PocketBeagle PWM pin typo (#192)
  cache board type to avoid poor performance (#196)

Signed-off-by: Drew Fustini <[email protected]>
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

No branches or pull requests

2 participants