diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index 70793156e9f..9051a77bd6d 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -131,7 +131,7 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) { - uint8_t free_channel = ~ledc_handle.used_channels & (ledc_handle.used_channels+1); + int free_channel = ~ledc_handle.used_channels & (ledc_handle.used_channels+1); if (free_channel == 0){ log_e("No more LEDC channels available! (maximum is %u channels)", LEDC_CHANNELS); return false;