From 9a5201866f4c6a6204b38da4352353615d729815 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/driver/gpio/gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/driver/gpio/gpio.c b/components/driver/gpio/gpio.c index 28f5966bdf..c7e4f006f3 100644 --- a/components/driver/gpio/gpio.c +++ b/components/driver/gpio/gpio.c @@ -435,11 +435,12 @@ esp_err_t gpio_config(const gpio_config_t *pGPIOConfig) esp_err_t gpio_reset_pin(gpio_num_t gpio_num) { assert(GPIO_IS_VALID_GPIO(gpio_num)); + bool pu_en = GPIO_IS_VALID_OUTPUT_GPIO(gpio_num); gpio_config_t cfg = { .pin_bit_mask = BIT64(gpio_num), .mode = GPIO_MODE_DISABLE, //for powersave reasons, the GPIO should not be floating, select pullup - .pull_up_en = true, + .pull_up_en = pu_en, .pull_down_en = false, .intr_type = GPIO_INTR_DISABLE, };