madhephaestus / ESP32Servo

Arduino-compatible servo library for the ESP32
140 stars 55 forks source link

analogWrite: do not allocate PWM channel when value is 0 or 255 #12

Closed FedericoBusero closed 4 years ago

FedericoBusero commented 4 years ago

When calling analogWrite with value 0 or 255, the code first allocates a PWM channel (in attachPin) and immediately after it detaches (deallocate) again. This is not necessary (and will cause problems when all channels are already occupied).