ledc.c: Fix analogWrite() last channel available verification (#8509)
* Fix analogWrite channel available verification The last channel allocated is number 0, which conflicted with the value given to an uninitialized pin, giving the "No more analogWrite channels available!" error when trying to use it Pins are now given the value -1 to indicate that they are not used so channel 0 can be used without errors. * Fix incorrect array initialization Keeping array of zeros for `pin_to_channel` and shifting stored channel values by +1 to keep the pin with channel 0 from being interpreted as unused. ref: https://github.com/espressif/arduino-esp32/pull/8509#issuecomment-1676103452
Showing
Please register or sign in to comment