Skip to content

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

@pemensik

Description

@pemensik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions