Skip to content

Commit 3722dba

Browse files
authored
fix(ledc): Fix freeing channel if not used anymore (#10094)
1 parent 3a7eda1 commit 3722dba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: cores/esp32/esp32-hal-ledc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ static bool ledcDetachBus(void *bus) {
5252
bool channel_found = false;
5353
// Check if more pins are attached to the same ledc channel
5454
for (uint8_t i = 0; i < SOC_GPIO_PIN_COUNT; i++) {
55-
if (!perimanPinIsValid(i)) {
56-
continue; //invalid pin, skip
55+
if (!perimanPinIsValid(i) || i == handle->pin) {
56+
continue; //invalid pin or same pin
5757
}
5858
peripheral_bus_type_t type = perimanGetPinBusType(i);
5959
if (type == ESP32_BUS_TYPE_LEDC) {

0 commit comments

Comments
 (0)