1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-28 21:53:48 +00: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

@@ -198,10 +198,15 @@ async def to_code(config):
cg.add_platformio_option("board_build.flash_mode", config[CONF_BOARD_FLASH_MODE])
ver: cv.Version = CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
cg.add_define(
"USE_ARDUINO_VERSION_CODE",
cg.RawExpression(f"VERSION_CODE({ver.major}, {ver.minor}, {ver.patch})"),
)
if config[CONF_BOARD] in ESP8266_FLASH_SIZES:
flash_size = ESP8266_FLASH_SIZES[config[CONF_BOARD]]
ld_scripts = ESP8266_LD_SCRIPTS[flash_size]
ver = CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
if ver <= cv.Version(2, 3, 0):
# No ld script support