Fix old-style arduino_version on ESP8266 and with magic values (#2591)

This commit is contained in:
Oxan van Leeuwen 2021-10-21 19:56:47 +02:00 committed by GitHub
parent c0fc5b48ae
commit 27d7d7ca69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,10 @@ __version__ = "2021.11.0-dev"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
TARGET_PLATFORMS = ["esp32", "esp8266"] PLATFORM_ESP32 = "esp32"
PLATFORM_ESP8266 = "esp8266"
TARGET_PLATFORMS = [PLATFORM_ESP32, PLATFORM_ESP8266]
TARGET_FRAMEWORKS = ["arduino", "esp-idf"] TARGET_FRAMEWORKS = ["arduino", "esp-idf"]
# See also https://github.com/platformio/platform-espressif8266/releases # See also https://github.com/platformio/platform-espressif8266/releases

View File

@ -29,6 +29,7 @@ from esphome.const import (
CONF_VERSION, CONF_VERSION,
KEY_CORE, KEY_CORE,
TARGET_PLATFORMS, TARGET_PLATFORMS,
PLATFORM_ESP8266,
) )
from esphome.core import CORE, coroutine_with_priority from esphome.core import CORE, coroutine_with_priority
from esphome.helpers import copy_file_if_changed, walk_files from esphome.helpers import copy_file_if_changed, walk_files
@ -182,8 +183,12 @@ def preload_core_config(config, result):
if CONF_BOARD_FLASH_MODE in conf: if CONF_BOARD_FLASH_MODE in conf:
plat_conf[CONF_BOARD_FLASH_MODE] = conf.pop(CONF_BOARD_FLASH_MODE) plat_conf[CONF_BOARD_FLASH_MODE] = conf.pop(CONF_BOARD_FLASH_MODE)
if CONF_ARDUINO_VERSION in conf: if CONF_ARDUINO_VERSION in conf:
plat_conf[CONF_FRAMEWORK] = {CONF_TYPE: "arduino"} plat_conf[CONF_FRAMEWORK] = {}
if plat != PLATFORM_ESP8266:
plat_conf[CONF_FRAMEWORK][CONF_TYPE] = "arduino"
try: try:
if conf[CONF_ARDUINO_VERSION] not in ("recommended", "latest", "dev"):
cv.Version.parse(conf[CONF_ARDUINO_VERSION]) cv.Version.parse(conf[CONF_ARDUINO_VERSION])
plat_conf[CONF_FRAMEWORK][CONF_VERSION] = conf.pop(CONF_ARDUINO_VERSION) plat_conf[CONF_FRAMEWORK][CONF_VERSION] = conf.pop(CONF_ARDUINO_VERSION)
except ValueError: except ValueError: