mirror of
https://github.com/esphome/esphome.git
synced 2025-01-09 22:31:46 +01:00
Allow manual overriding of esp-adf board
This commit is contained in:
parent
c19f0cf6bc
commit
fce2eafda0
1 changed files with 14 additions and 5 deletions
|
@ -5,7 +5,7 @@ import esphome.codegen as cg
|
||||||
|
|
||||||
from esphome.components import esp32
|
from esphome.components import esp32
|
||||||
|
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID, CONF_BOARD
|
||||||
|
|
||||||
CONFLICTS_WITH = ["i2s_audio"]
|
CONFLICTS_WITH = ["i2s_audio"]
|
||||||
CODEOWNERS = ["@jesserockz"]
|
CODEOWNERS = ["@jesserockz"]
|
||||||
|
@ -17,18 +17,26 @@ esp_adf_ns = cg.esphome_ns.namespace("esp_adf")
|
||||||
ESPADF = esp_adf_ns.class_("ESPADF", cg.Component)
|
ESPADF = esp_adf_ns.class_("ESPADF", cg.Component)
|
||||||
ESPADFPipeline = esp_adf_ns.class_("ESPADFPipeline", cg.Parented.template(ESPADF))
|
ESPADFPipeline = esp_adf_ns.class_("ESPADFPipeline", cg.Parented.template(ESPADF))
|
||||||
|
|
||||||
SUPPORTED_BOARDS = {"esp32s3box": "CONFIG_ESP32_S3_BOX_BOARD"}
|
SUPPORTED_BOARDS = {
|
||||||
|
"esp32s3box": "CONFIG_ESP32_S3_BOX_BOARD",
|
||||||
|
"esp32s3boxlite": "CONFIG_ESP32_S3_BOX_LITE_BOARD",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _validate_board(config):
|
def _validate_board(config):
|
||||||
board = esp32.get_board()
|
board = config.get(CONF_BOARD, esp32.get_board())
|
||||||
if board not in SUPPORTED_BOARDS:
|
if board not in SUPPORTED_BOARDS:
|
||||||
raise cv.Invalid(f"Board {board} is not supported by esp-adf")
|
raise cv.Invalid(f"Board {board} is not supported by esp-adf")
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.All(
|
CONFIG_SCHEMA = cv.All(
|
||||||
cv.Schema({cv.GenerateID(): cv.declare_id(ESPADF)}),
|
cv.Schema(
|
||||||
|
{
|
||||||
|
cv.GenerateID(): cv.declare_id(ESPADF),
|
||||||
|
cv.Optional(CONF_BOARD): cv.string_strict,
|
||||||
|
}
|
||||||
|
),
|
||||||
_validate_board,
|
_validate_board,
|
||||||
cv.only_with_esp_idf,
|
cv.only_with_esp_idf,
|
||||||
)
|
)
|
||||||
|
@ -54,7 +62,8 @@ async def to_code(config):
|
||||||
cg.add_platformio_option(
|
cg.add_platformio_option(
|
||||||
"board_build.embed_txtfiles", "components/dueros_service/duer_profile"
|
"board_build.embed_txtfiles", "components/dueros_service/duer_profile"
|
||||||
)
|
)
|
||||||
esp32.add_idf_sdkconfig_option(SUPPORTED_BOARDS[esp32.get_board()], True)
|
board = config.get(CONF_BOARD, esp32.get_board())
|
||||||
|
esp32.add_idf_sdkconfig_option(SUPPORTED_BOARDS[board], True)
|
||||||
|
|
||||||
esp32.add_extra_script(
|
esp32.add_extra_script(
|
||||||
"pre",
|
"pre",
|
||||||
|
|
Loading…
Reference in a new issue