Skip to content
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

PWM.start() call cannot be repeated unlike RPi.GPIO #53

Open
pemensik opened this issue Mar 7, 2021 · 0 comments
Open

PWM.start() call cannot be repeated unlike RPi.GPIO #53

pemensik opened this issue Mar 7, 2021 · 0 comments

Comments

@pemensik
Copy link

pemensik commented Mar 7, 2021

I was testing pibrella test example with RPi.GPIO2. It prints annoying warning:

/usr/local/lib/python3.9/site-packages/RPi/core.py:530: UserWarning: invalid call to pwm_start(). Did you call PWM.__init__() on this channel?
  warn("invalid call to pwm_start(). Did you call PWM.__init__() on this channel?")

I thought it was pibrella error, but it would work with original RPi.GPIO. pibrella uses PWM.start() multiple times when playing notes. Printed warning is highly misleading, because it DID construct PWM() object. It just uses start() method multiple times without stop(). I would suggest PWM class checking for started flag in start(), because it would know object were initialized.

pemensik added a commit to pemensik/RPi.GPIO2 that referenced this issue Mar 7, 2021
Original C version allows repeated PWM.start() calls, because it just
ignores start() call once helper thread is running. Emulate such
behaviour and avoid printing warnings if already started.

Fixes issue underground-software#53.
pemensik added a commit to pemensik/RPi.GPIO2 that referenced this issue Mar 7, 2021
Original C version allows repeated PWM.start() calls, because it just
ignores start() call once helper thread is running. Emulate such
behaviour and avoid printing warnings if already started.

Fixes issue underground-software#53.
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

1 participant