From 9317ecb4ea44a45be19326d40b1c67d92500793e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Rem=C3=A9ny?= <25034625+remenyo@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:04:27 +0200 Subject: [PATCH] fix(gpio): Avoid error message when calling reset on an input only pin. The `gpio_reset_pin` function attempted to enable internal pullup on pins which does not have one. This change adds a guard to `gpio_reset_pin` for calling `gpio_pullup_en` - the same guard that makes `gpio_pullup_en` print the error. --- components/esp_driver_gpio/src/gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/esp_driver_gpio/src/gpio.c b/components/esp_driver_gpio/src/gpio.c index fcf422824e..677297aa97 100644 --- a/components/esp_driver_gpio/src/gpio.c +++ b/components/esp_driver_gpio/src/gpio.c @@ -457,8 +457,10 @@ esp_err_t gpio_reset_pin(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); gpio_intr_disable(gpio_num); - // for powersave reasons, the GPIO should not be floating, select pullup - gpio_pullup_en(gpio_num); + if (GPIO_IS_VALID_OUTPUT_GPIO(gpio_num)) { + // for powersave reasons, the GPIO should not be floating, select pullup + gpio_pullup_en(gpio_num); + } gpio_pulldown_dis(gpio_num); gpio_input_disable(gpio_num); gpio_output_disable(gpio_num);