1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-02 01:52:21 +01:00

Add config to allow suppression of warnings about use of strapping pins (#5287)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Clyde Stubbs
2023-10-19 09:04:53 +09:00
committed by GitHub
parent 799c3cf439
commit a794836ebe
10 changed files with 38 additions and 45 deletions

View File

@@ -1,6 +1,7 @@
import logging
from esphome.const import CONF_INPUT, CONF_MODE, CONF_NUMBER
from esphome.pins import check_strapping_pin
import esphome.config_validation as cv
@@ -12,13 +13,6 @@ _LOGGER = logging.getLogger(__name__)
def esp32_c2_validate_gpio_pin(value):
if value < 0 or value > 20:
raise cv.Invalid(f"Invalid pin number: {value} (must be 0-20)")
if value in _ESP32C2_STRAPPING_PINS:
_LOGGER.warning(
"GPIO%d is a Strapping PIN and should be avoided.\n"
"Attaching external pullup/down resistors to strapping pins can cause unexpected failures.\n"
"See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins",
value,
)
return value
@@ -34,4 +28,6 @@ def esp32_c2_validate_supports(value):
if is_input:
# All ESP32 pins support input mode
pass
check_strapping_pin(value, _ESP32C2_STRAPPING_PINS, _LOGGER)
return value