mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[wifi] Allow config to use PSRAM (#9866)
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| from esphome import automation | from esphome import automation | ||||||
| from esphome.automation import Condition | from esphome.automation import Condition | ||||||
| import esphome.codegen as cg | 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.esp32 import add_idf_sdkconfig_option, const, get_esp32_variant | ||||||
| from esphome.components.network import IPAddress | from esphome.components.network import IPAddress | ||||||
| from esphome.config_helpers import filter_source_files_from_platform | 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( |             cv.Optional(CONF_ON_DISCONNECT): automation.validate_automation( | ||||||
|                 single=True |                 single=True | ||||||
|             ), |             ), | ||||||
|  |             cv.Optional(CONF_USE_PSRAM): cv.All( | ||||||
|  |                 cv.requires_component("psram"), cv.boolean | ||||||
|  |             ), | ||||||
|         } |         } | ||||||
|     ), |     ), | ||||||
|     _validate, |     _validate, | ||||||
| @@ -454,6 +458,8 @@ async def to_code(config): | |||||||
|         if config[CONF_ENABLE_RRM]: |         if config[CONF_ENABLE_RRM]: | ||||||
|             cg.add(var.set_rrm(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") |     cg.add_define("USE_WIFI") | ||||||
|  |  | ||||||
|     # must register before OTA safe mode check |     # must register before OTA safe mode check | ||||||
|   | |||||||
| @@ -1 +1,7 @@ | |||||||
| <<: !include common.yaml | psram: | ||||||
|  |  | ||||||
|  | wifi: | ||||||
|  |   use_psram: true | ||||||
|  |  | ||||||
|  | packages: | ||||||
|  |   - !include common.yaml | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user