thiagoralves / OpenPLC_Editor

OpenPLC Editor - IDE capable of creating programs for the OpenPLC Runtime
GNU General Public License v2.0
385 stars 191 forks source link

Update esp32.cpp #93

Closed CloudHead84 closed 8 months ago

CloudHead84 commented 8 months ago

Added 8 possible PWM pins for the PWM_CONTROLLER function block.

Tested on a ESP32 WROOM (devkit v1) board.

All eight pwm channels tested in parallel with different frequencys. Output check via Osziloscope.

thiagoralves commented 8 months ago

Great contribution. Thank you! Just one final request: convert your file to use spaces instead of tabs. This works better with the alignment of things and makes the code more readable.

thiagoralves commented 8 months ago

Also, at the init_pwm function, it would be wise to disable the PWM pins from all IO masks, not only the analog out. Since the ESP32 has 8 PWM capable pins and only 2 pins marked as analog out on OpenPLC, this could result in conflict later with the pin being used as a digital input or something else, and being used by the PWM_CONTROLLER at the same time

thiagoralves commented 8 months ago

Thank you! This is perfect