From 5e5137960d5bfc179a3b5cf75724c986afd50f89 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 26 Sep 2018 01:27:47 +0900 Subject: [PATCH] Limit upload speed to 115200 (#122) * Limit upload speed to 115200 * Lint --- esphomeyaml/writer.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/esphomeyaml/writer.py b/esphomeyaml/writer.py index 8bd463a6b4..af175cb576 100644 --- a/esphomeyaml/writer.py +++ b/esphomeyaml/writer.py @@ -7,9 +7,9 @@ import os from esphomeyaml import core from esphomeyaml.config import iter_components -from esphomeyaml.const import CONF_ARDUINO_VERSION, CONF_BOARD, CONF_BOARD_FLASH_MODE, \ - CONF_ESPHOMELIB_VERSION, CONF_ESPHOMEYAML, CONF_LOCAL, CONF_NAME, CONF_USE_CUSTOM_CODE, \ - ESP_PLATFORM_ESP32, ARDUINO_VERSION_ESP32_DEV +from esphomeyaml.const import ARDUINO_VERSION_ESP32_DEV, CONF_ARDUINO_VERSION, CONF_BOARD, \ + CONF_BOARD_FLASH_MODE, CONF_ESPHOMELIB_VERSION, CONF_ESPHOMEYAML, CONF_LOCAL, CONF_NAME, \ + CONF_USE_CUSTOM_CODE, ESP_PLATFORM_ESP32 from esphomeyaml.core import ESPHomeYAMLError from esphomeyaml.core_config import VERSION_REGEX from esphomeyaml.helpers import relative_path @@ -60,8 +60,13 @@ lib_deps = build_flags = {build_flags} ${{common.build_flags}} +upload_speed = {upload_speed} """ +UPLOAD_SPEED_OVERRIDE = { + 'esp210': 57600, +} + def get_build_flags(config, key): build_flags = set() @@ -86,6 +91,7 @@ def get_ini_content(config, path): u'platform': config[CONF_ESPHOMEYAML][CONF_ARDUINO_VERSION], u'board': config[CONF_ESPHOMEYAML][CONF_BOARD], u'build_flags': u'', + u'upload_speed': UPLOAD_SPEED_OVERRIDE.get(core.BOARD, 115200), } build_flags = set() if not config[CONF_ESPHOMEYAML][CONF_USE_CUSTOM_CODE]: