Skip to content

Commit 224dea9

Browse files
committed
fix(ledc): Fix check of maximum channel
1 parent 200fe29 commit 224dea9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp32/esp32-hal-ledc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static bool ledcDetachBus(void * bus){
5858

5959
bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, int channel)
6060
{
61-
if (channel > LEDC_CHANNELS || resolution > LEDC_MAX_BIT_WIDTH)
61+
if (channel >= LEDC_CHANNELS || resolution > LEDC_MAX_BIT_WIDTH)
6262
{
6363
log_e("Channel %u is not available! (maximum %u) or bit width too big (maximum %u)", channel, LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH);
6464
return false;

0 commit comments

Comments
 (0)