From 3437e23c8e53864cf551c2bbc651fc9d96b2ba4d Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 19 Jan 2019 22:14:46 +0100 Subject: [PATCH] Disable platformio LDF (#352) * Disable platformio LDF * Use required build flags --- .../components/light/fastled_clockless.py | 2 +- esphomeyaml/components/light/fastled_spi.py | 2 +- esphomeyaml/components/light/neopixelbus.py | 2 +- esphomeyaml/components/web_server.py | 2 +- esphomeyaml/writer.py | 26 +++++++++++++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/esphomeyaml/components/light/fastled_clockless.py b/esphomeyaml/components/light/fastled_clockless.py index f1d12b6d7e..35f4e81922 100644 --- a/esphomeyaml/components/light/fastled_clockless.py +++ b/esphomeyaml/components/light/fastled_clockless.py @@ -102,7 +102,7 @@ def to_code(config): setup_component(fast_led, config) -BUILD_FLAGS = '-DUSE_FAST_LED_LIGHT' +REQUIRED_BUILD_FLAGS = '-DUSE_FAST_LED_LIGHT' LIB_DEPS = 'FastLED@3.2.0' diff --git a/esphomeyaml/components/light/fastled_spi.py b/esphomeyaml/components/light/fastled_spi.py index 957130f247..d8cf15bed1 100644 --- a/esphomeyaml/components/light/fastled_spi.py +++ b/esphomeyaml/components/light/fastled_spi.py @@ -82,7 +82,7 @@ def to_code(config): setup_component(fast_led, config) -BUILD_FLAGS = '-DUSE_FAST_LED_LIGHT' +REQUIRED_BUILD_FLAGS = '-DUSE_FAST_LED_LIGHT' LIB_DEPS = 'FastLED@3.2.0' diff --git a/esphomeyaml/components/light/neopixelbus.py b/esphomeyaml/components/light/neopixelbus.py index 01841094e7..ac6cab427a 100644 --- a/esphomeyaml/components/light/neopixelbus.py +++ b/esphomeyaml/components/light/neopixelbus.py @@ -160,7 +160,7 @@ def to_code(config): setup_component(output, config) -BUILD_FLAGS = '-DUSE_NEO_PIXEL_BUS_LIGHT' +REQUIRED_BUILD_FLAGS = '-DUSE_NEO_PIXEL_BUS_LIGHT' LIB_DEPS = 'NeoPixelBus@2.4.1' diff --git a/esphomeyaml/components/web_server.py b/esphomeyaml/components/web_server.py index d70bc25cda..aca7b8bbcb 100644 --- a/esphomeyaml/components/web_server.py +++ b/esphomeyaml/components/web_server.py @@ -28,7 +28,7 @@ def to_code(config): setup_component(web_server, config) -BUILD_FLAGS = '-DUSE_WEB_SERVER' +REQUIRED_BUILD_FLAGS = '-DUSE_WEB_SERVER' def lib_deps(config): diff --git a/esphomeyaml/writer.py b/esphomeyaml/writer.py index a6b1a4b7b1..0febccf86b 100644 --- a/esphomeyaml/writer.py +++ b/esphomeyaml/writer.py @@ -343,6 +343,32 @@ def get_ini_content(): flash_mode = CORE.config[CONF_ESPHOMEYAML][CONF_BOARD_FLASH_MODE] data['board_build.flash_mode'] = flash_mode + if CORE.is_esp8266: + # On ESP8266, we can disable LDF + data['lib_ldf_mode'] = 'off' + elif CORE.is_esp32: + # On ESP32, we need to enable LDF + # and can manually remove all libraries we don't need + data['lib_ldf_mode'] = 'chain' + REMOVABLE_LIBRARIES = [ + 'ArduinoOTA', + 'ESPmDNS', + 'Update', + 'Wire', + 'FastLED', + 'NeoPixelBus', + 'ESP Async WebServer', + ] + ignore = [] + for x in REMOVABLE_LIBRARIES: + for o in lib_deps: + if x in o: + break + else: + ignore.append(x) + if ignore: + data['lib_ignore'] = ignore + data.update(CORE.config[CONF_ESPHOMEYAML].get(CONF_PLATFORMIO_OPTIONS, {})) content = u'[env:{}]\n'.format(CORE.name)