vitormhenrique / OctoPrint-Enclosure

OctoPrint Enclosure Plugin
GNU General Public License v3.0
395 stars 201 forks source link

PWM Duty cycle not correct #472

Open Zounich opened 2 years ago

Zounich commented 2 years ago

Hi vitormhenrique,

I am using octoprint on a Raspberry PI 2B. With GPIO 23 I control a lamp via pwm.

image

After I have saved the configuration, I can dim the lamp. However, I have 2 problems:

1: If I set 10% in the enclosure plugin, I get 16% on the GPIO.

2: The PWM signal is interrupted and for a few ms. the GPO spent 100%.

Here is the log:

2022-01-19 23:36:18,994 - octoprint.plugins.enclosure - INFO - Setting GPIO mode to BCM 2022-01-19 23:36:18,996 - octoprint.plugins.enclosure - INFO - Setting GPIO pin 13 as PWM 2022-01-19 23:36:18,998 - octoprint.plugins.enclosure - INFO - starting PWM on pin 13

When I check the GPIO configuration, GPIO 23 shows as OUT and not ALT0.

image

If I configure PWM via the terminal and control it there, it works without errors.

Do you have an idea where the cause for this could be?

Best Regards Zounich

vitormhenrique commented 2 years ago

I have no clue what is going on. I use python libraries, so if you create scripts on python with the same libraries do the error still happens? I'm guessing those are erros on the libraries.