Skip to content

PWM class "stop" method #7

@Matei-Ciobotaru

Description

@Matei-Ciobotaru

Hi Leapo,

First off, thanks for taking the time to write this python library!

I was playing around with it on my Rock64 SBC and noticed the following:

  1. The GPIO.PWM.stop() method does not work as intended.

The PWM.stop method uses the multiprocessing.Process.terminate.
This approach stops the process, but does not respect the pwm_process static method try/except clauses, as such when calling the stop method the var_gpio_filepath file is written with the last value that was set by the pwm_process before calling it.
As a result, when calling PWM.stop the output GPIO PIN is set erroneously to 1 part of the time.

I have addressed this issue here.

  1. pwm_busywait method proves too CPU intensive, constantly taking up 100% CPU time.

I have set the default 'pwm_precission' arg to 'LOW', as the linux kernel is able to achieve a acceptable error margin on its own using time.sleep,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions