1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-28 13:43:54 +00: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

@@ -10,6 +10,7 @@ from esphome.const import (
)
import esphome.config_validation as cv
from esphome.pins import check_strapping_pin
_ESP32S2_SPI_PSRAM_PINS = {
26: "SPICS1",
@@ -34,13 +35,6 @@ def esp32_s2_validate_gpio_pin(value):
raise cv.Invalid(
f"This pin cannot be used on ESP32-S2s and is already used by the SPI/PSRAM interface (function: {_ESP32S2_SPI_PSRAM_PINS[value]})"
)
if value in _ESP32S2_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,
)
if value in (22, 23, 24, 25):
# These pins are not exposed in GPIO mux (reason unknown)
@@ -77,4 +71,5 @@ def esp32_s2_validate_supports(value):
f"GPIO{num} does not support pulldowns.", [CONF_MODE, CONF_PULLDOWN]
)
check_strapping_pin(value, _ESP32S2_STRAPPING_PINS, _LOGGER)
return value