1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 01:32:19 +01:00

Generate ARDUINO_VERSION_CODE in Python code (#3101)

Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Oxan van Leeuwen
2022-01-24 10:34:34 +01:00
committed by GitHub
parent f2d677d51a
commit cdda648360
15 changed files with 71 additions and 98 deletions

View File

@@ -293,6 +293,8 @@ async def to_code(config):
cg.add_platformio_option("lib_ldf_mode", "off")
framework_ver: cv.Version = CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
conf = config[CONF_FRAMEWORK]
cg.add_platformio_option("platform", conf[CONF_PLATFORM_VERSION])
@@ -335,6 +337,13 @@ async def to_code(config):
"CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE", False
)
cg.add_define(
"USE_ESP_IDF_VERSION_CODE",
cg.RawExpression(
f"VERSION_CODE({framework_ver.major}, {framework_ver.minor}, {framework_ver.patch})"
),
)
elif conf[CONF_TYPE] == FRAMEWORK_ARDUINO:
cg.add_platformio_option("framework", "arduino")
cg.add_build_flag("-DUSE_ARDUINO")
@@ -346,6 +355,13 @@ async def to_code(config):
cg.add_platformio_option("board_build.partitions", "partitions.csv")
cg.add_define(
"USE_ARDUINO_VERSION_CODE",
cg.RawExpression(
f"VERSION_CODE({framework_ver.major}, {framework_ver.minor}, {framework_ver.patch})"
),
)
ARDUINO_PARTITIONS_CSV = """\
nvs, data, nvs, 0x009000, 0x005000,