[psram] Require mode for S3 (#11470)

Co-authored-by: clydeps <U5yx99dok9>
This commit is contained in:
Clyde Stubbs
2025-11-04 13:38:43 +10:00
committed by GitHub
parent ce63137565
commit 758ac58343
8 changed files with 60 additions and 31 deletions

View File

@@ -34,6 +34,12 @@ SUPPORTED_PSRAM_VARIANTS = [
VARIANT_ESP32S3,
VARIANT_ESP32P4,
]
SUPPORTED_PSRAM_MODES = {
VARIANT_ESP32: ["quad"],
VARIANT_ESP32S2: ["quad"],
VARIANT_ESP32S3: ["quad", "octal"],
VARIANT_ESP32P4: ["hex"],
}
@pytest.mark.parametrize(
@@ -86,7 +92,7 @@ def test_psram_configuration_valid_supported_variants(
from esphome.components.psram import CONFIG_SCHEMA, FINAL_VALIDATE_SCHEMA
# This should not raise an exception
config = CONFIG_SCHEMA({})
config = CONFIG_SCHEMA({"mode": SUPPORTED_PSRAM_MODES[variant][0]})
FINAL_VALIDATE_SCHEMA(config)
@@ -122,7 +128,7 @@ def _setup_psram_final_validation_test(
("config", "esp32_config", "expect_error", "error_match"),
[
pytest.param(
{"speed": "120MHz"},
{"mode": "quad", "speed": "120MHz"},
{"cpu_frequency": "160MHz"},
True,
r"PSRAM 120MHz requires 240MHz CPU frequency",
@@ -143,7 +149,7 @@ def _setup_psram_final_validation_test(
id="ecc_only_in_octal_mode",
),
pytest.param(
{"speed": "120MHZ"},
{"mode": "quad", "speed": "120MHZ"},
{"cpu_frequency": "240MHZ"},
False,
None,