[wifi] Allow config to use PSRAM (#9866)

This commit is contained in:
Clyde Stubbs 2025-07-27 07:45:20 +10:00 committed by GitHub
parent 981b906579
commit cf73f72119
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,7 @@
from esphome import automation
from esphome.automation import Condition
import esphome.codegen as cg
from esphome.components.const import CONF_USE_PSRAM
from esphome.components.esp32 import add_idf_sdkconfig_option, const, get_esp32_variant
from esphome.components.network import IPAddress
from esphome.config_helpers import filter_source_files_from_platform
@ -334,6 +335,9 @@ CONFIG_SCHEMA = cv.All(
cv.Optional(CONF_ON_DISCONNECT): automation.validate_automation(
single=True
),
cv.Optional(CONF_USE_PSRAM): cv.All(
cv.requires_component("psram"), cv.boolean
),
}
),
_validate,
@ -454,6 +458,8 @@ async def to_code(config):
if config[CONF_ENABLE_RRM]:
cg.add(var.set_rrm(config[CONF_ENABLE_RRM]))
if config.get(CONF_USE_PSRAM):
add_idf_sdkconfig_option("CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP", True)
cg.add_define("USE_WIFI")
# must register before OTA safe mode check

View File

@ -1 +1,7 @@
<<: !include common.yaml
psram:
wifi:
use_psram: true
packages:
- !include common.yaml