1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 23:21:54 +00:00

[psram] Fix invalid variant error, add supported() check (#10962)

This commit is contained in:
Jesse Hills
2025-10-01 23:29:10 +13:00
committed by GitHub
parent 922f4b6352
commit 848ba6b717

View File

@@ -62,6 +62,11 @@ SPIRAM_SPEEDS = {
} }
def supported() -> bool:
variant = get_esp32_variant()
return variant in SPIRAM_MODES
def validate_psram_mode(config): def validate_psram_mode(config):
esp32_config = fv.full_config.get()[PLATFORM_ESP32] esp32_config = fv.full_config.get()[PLATFORM_ESP32]
if config[CONF_SPEED] == "120MHZ": if config[CONF_SPEED] == "120MHZ":
@@ -95,7 +100,7 @@ def get_config_schema(config):
variant = get_esp32_variant() variant = get_esp32_variant()
speeds = [f"{s}MHZ" for s in SPIRAM_SPEEDS.get(variant, [])] speeds = [f"{s}MHZ" for s in SPIRAM_SPEEDS.get(variant, [])]
if not speeds: if not speeds:
return cv.Invalid("PSRAM is not supported on this chip") raise cv.Invalid("PSRAM is not supported on this chip")
modes = SPIRAM_MODES[variant] modes = SPIRAM_MODES[variant]
return cv.Schema( return cv.Schema(
{ {