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.
This commit is contained in:
Olivér Remény
2025-07-29 11:04:27 +02:00
committed by Song Ruo Jing
parent 819970f439
commit 9317ecb4ea

View File

@@ -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_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
gpio_intr_disable(gpio_num); gpio_intr_disable(gpio_num);
if (GPIO_IS_VALID_OUTPUT_GPIO(gpio_num)) {
// for powersave reasons, the GPIO should not be floating, select pullup // for powersave reasons, the GPIO should not be floating, select pullup
gpio_pullup_en(gpio_num); gpio_pullup_en(gpio_num);
}
gpio_pulldown_dis(gpio_num); gpio_pulldown_dis(gpio_num);
gpio_input_disable(gpio_num); gpio_input_disable(gpio_num);
gpio_output_disable(gpio_num); gpio_output_disable(gpio_num);