diff --git a/.gitignore b/.gitignore index db3138f5..a95dd5ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .pio +.cache .pioenvs .piolibdeps .vscode @@ -6,6 +7,8 @@ /wled00/Release /wled00/extLibs /platformio_override.ini +/wled00/my_config.h +/build_output .DS_Store .gitignore .clang-format diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 00000000..29d75d19 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,5 @@ +FROM gitpod/workspace-full + +USER gitpod + +RUN pip3 install -U platformio diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..cc416b1c --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,12 @@ +tasks: + - command: platformio run + +image: + file: .gitpod.Dockerfile + +vscode: + extensions: + - ms-vscode.cpptools@0.26.3:u3GsZ5PK12Ddr79vh4TWgQ== + - eamodio.gitlens@10.2.1:e0IYyp0efFqVsrZwsIe8CA== + - Atishay-Jain.All-Autocomplete@0.0.23:fbZNfSpnd8XkAHGfAPS2rA== + - 2gua.rainbow-brackets@0.0.6:Tbu8dTz0i+/bgcKQTQ5b8g== diff --git a/pio/gzip-firmware.py b/pio/gzip-firmware.py new file mode 100644 index 00000000..2d028301 --- /dev/null +++ b/pio/gzip-firmware.py @@ -0,0 +1,23 @@ +Import('env') +import os +import shutil +import gzip + +OUTPUT_DIR = "build_output{}".format(os.path.sep) + +def bin_gzip(source, target, env): + variant = str(target[0]).split(os.path.sep)[2] + + # create string with location and file names based on variant + bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) + gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant) + + # check if new target files exist and remove if necessary + if os.path.isfile(gzip_file): os.remove(gzip_file) + + # write gzip firmware file + with open(bin_file,"rb") as fp: + with gzip.open(gzip_file, "wb", compresslevel = 9) as f: + shutil.copyfileobj(fp, f) + +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip]) diff --git a/pio/name-firmware.py b/pio/name-firmware.py new file mode 100644 index 00000000..90ea9867 --- /dev/null +++ b/pio/name-firmware.py @@ -0,0 +1,34 @@ +Import('env') +import os +import shutil + +OUTPUT_DIR = "build_output{}".format(os.path.sep) + +def bin_rename_copy(source, target, env): + variant = str(target[0]).split(os.path.sep)[2] + + # check if output directories exist and create if necessary + if not os.path.isdir(OUTPUT_DIR): + os.mkdir(OUTPUT_DIR) + + for d in ['firmware', 'map']: + if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)): + os.mkdir("{}{}".format(OUTPUT_DIR, d)) + + # create string with location and file names based on variant + map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant) + bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) + + # check if new target files exist and remove if necessary + for f in [map_file, bin_file]: + if os.path.isfile(f): + os.remove(f) + + # copy firmware.bin to firmware/.bin + shutil.copy(str(target[0]), bin_file) + + # copy firmware.map to map/.map + if os.path.isfile("firmware.map"): + shutil.move("firmware.map", map_file) + +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy]) diff --git a/pio/obj-dump.py b/pio/obj-dump.py new file mode 100644 index 00000000..91bc3de5 --- /dev/null +++ b/pio/obj-dump.py @@ -0,0 +1,9 @@ +# Little convenience script to get an object dump + +Import('env') + +def obj_dump_after_elf(source, target, env): + print("Create firmware.asm") + env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm") + +env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf]) diff --git a/pio/strip-floats.py b/pio/strip-floats.py new file mode 100644 index 00000000..da916ebe --- /dev/null +++ b/pio/strip-floats.py @@ -0,0 +1,15 @@ +Import('env') + +# +# Dump build environment (for debug) +#print env.Dump() +# + +flags = " ".join(env['LINKFLAGS']) +flags = flags.replace("-u _printf_float", "") +flags = flags.replace("-u _scanf_float", "") +newflags = flags.split() + +env.Replace( + LINKFLAGS=newflags +) \ No newline at end of file diff --git a/pio/user_config_copy.py b/pio/user_config_copy.py new file mode 100644 index 00000000..1251ca17 --- /dev/null +++ b/pio/user_config_copy.py @@ -0,0 +1,9 @@ +Import('env') +import os +import shutil + +# copy WLED00/my_config_sample.h to WLED00/my_config.h +if os.path.isfile("wled00/my_config.h"): + print ("*** use existing my_config.h ***") +else: + shutil.copy("wled00/my_config_sample.h", "wled00/my_config.h") diff --git a/platformio.ini b/platformio.ini index 3be72fe4..c23047e6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2,20 +2,13 @@ ; Please visit documentation: https://docs.platformio.org/page/projectconf.html [platformio] -src_dir = ./wled00 -data_dir = ./wled00/data -lib_dir = ./wled00/src -build_cache_dir = ~/.buildcache -extra_configs = - platformio_override.ini - # ------------------------------------------------------------------------------ # ENVIRONMENTS # # Please uncomment one of the lines below to select your board(s) # ------------------------------------------------------------------------------ -# Travis CI binaries +# Travis CI binaries (comment this out with a ';' when building for your own board) default_envs = travis_esp8266, travis_esp32 # Release binaries @@ -41,36 +34,21 @@ default_envs = travis_esp8266, travis_esp32 ; default_envs = m5atom ; default_envs = esp32_poe +src_dir = ./wled00 +data_dir = ./wled00/data +build_cache_dir = ~/.buildcache +extra_configs = + platformio_override.ini + [common] # ------------------------------------------------------------------------------ # PLATFORM: # !! DO NOT confuse platformio's ESP8266 development platform with Arduino core for ESP8266 # -# arduino core 2.3.0 = platformIO 1.5.0 -# arduino core 2.4.0 = platformIO 1.6.0 -# arduino core 2.4.1 = platformIO 1.7.3 -# arduino core 2.4.2 = platformIO 1.8.0 -# arduino core 2.5.0 = platformIO 2.0.4 -# arduino core 2.5.1 = platformIO 2.1.1 -# arduino core 2.5.2 = platformIO 2.2.3 -# arduino core 2.6.1 = platformIO 2.3.0 -# arduino core 2.6.2 = platformIO 2.3.1 # arduino core 2.6.3 = platformIO 2.3.2 # arduino core 2.7.0 = platformIO 2.5.0 # ------------------------------------------------------------------------------ -arduino_core_2_3_0 = espressif8266@1.5.0 -arduino_core_2_4_0 = espressif8266@1.6.0 -arduino_core_2_4_1 = espressif8266@1.7.3 -arduino_core_2_4_2 = espressif8266@1.8.0 -arduino_core_2_5_0 = espressif8266@2.0.4 -arduino_core_2_5_1 = espressif8266@2.1.1 -arduino_core_2_5_2 = espressif8266@2.2.3 -arduino_core_2_6_1 = espressif8266@2.3.0 -arduino_core_2_6_2 = espressif8266@2.3.1 arduino_core_2_6_3 = espressif8266@2.3.3 -arduino_core_2_7_1 = espressif8266@2.5.1 -arduino_core_2_7_2 = espressif8266@2.6.0 -arduino_core_2_7_3 = espressif8266@2.6.1 arduino_core_2_7_4 = espressif8266@2.6.2 # Development platforms @@ -79,8 +57,8 @@ arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/ # Platform to use for ESP8266 platform_wled_default = ${common.arduino_core_2_7_4} -# We use 2.7.0+ on analog boards because of PWM flicker fix -platform_latest = ${common.arduino_core_2_7_4} +# We use 2.7.4.7 for all, includes PWM flicker fix and Wstring optimization +platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7 # ------------------------------------------------------------------------------ # FLAGS: DEBUG @@ -91,7 +69,7 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT #-DDEBUG_ESP_CORE is not working right now # ------------------------------------------------------------------------------ -# FLAGS: ldscript +# FLAGS: ldscript (available ldscripts at https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld) # ldscript_512k ( 512 KB) = 487 KB sketch, 4 KB eeprom, no spiffs, 16 KB reserved # ldscript_1m0m (1024 KB) = 999 KB sketch, 4 KB eeprom, no spiffs, 16 KB reserved # ldscript_2m1m (2048 KB) = 1019 KB sketch, 4 KB eeprom, 1004 KB spiffs, 16 KB reserved @@ -102,6 +80,7 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT # -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH = v1.4 Higher Bandwidth (default) # -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY = v2 Lower Memory # -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH = v2 Higher Bandwidth +# -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH # # BearSSL performance: # When building with -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL, please add `board_build.f_cpu = 160000000` to the environment configuration @@ -114,18 +93,35 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT # TLS_RSA_WITH_AES_256_CBC_SHA / AES256-SHA # This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m). # ------------------------------------------------------------------------------ -build_flags = -g -w -DMQTT_MAX_PACKET_SIZE=1024 -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH - -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL -DBEARSSL_SSL_BASIC - #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here) +build_flags = + -Wno-switch + -Wno-deprecated-declarations + -Wno-write-strings + -Wno-unused-variable + -Wno-unused-value + -Wno-sign-compare + -Wno-unused-but-set-variable + -Wno-return-type + -Wno-sequence-point + -Wno-narrowing + -Wno-reorder + -DMQTT_MAX_PACKET_SIZE=1024 + -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL + -DBEARSSL_SSL_BASIC + -D CORE_DEBUG_LEVEL=0 + -D NDEBUG + #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here) -D _IR_ENABLE_DEFAULT_=false -D DECODE_HASH=true -D DECODE_NEC=true -D DECODE_SONY=true -D DECODE_SAMSUNG=true -D DECODE_LG=true - -build_flags_esp8266 = ${common.build_flags} -DESP8266 -build_flags_esp32 = ${common.build_flags} -DARDUINO_ARCH_ESP32 -DCONFIG_LITTLEFS_FOR_IDF_3_2 + -DWLED_USE_MY_CONFIG + +build_unflags = + -Wall + -Wdeprecated-declarations # enables all features for travis CI build_flags_all_features = @@ -137,15 +133,39 @@ build_flags_all_features = -D WLED_ENABLE_MQTT -D WLED_ENABLE_WEBSOCKETS +build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags} +build_flags_esp32 = ${common.build_flags} ${esp32.build_flags} + ldscript_512k = eagle.flash.512k.ld ;for older versions change this to eagle.flash.512k0.ld ldscript_1m0m = eagle.flash.1m.ld ;for older versions change this to eagle.flash.1m0.ld ldscript_1m128k = eagle.flash.1m128.ld ldscript_2m512k = eagle.flash.2m512.ld ldscript_2m1m = eagle.flash.2m1m.ld ldscript_4m1m = eagle.flash.4m1m.ld -ldscript_4m3m = eagle.flash.4m3m.ld -shared_libdeps_dir = ./wled00/src +[esp8266] +build_flags = + -DESP8266 + -DFP_IN_IROM +; NONOSDK22x_190703 = 2.2.2-dev(38a443e) + -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 +; lwIP 2 - Higher Bandwidth no Features + -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH +; VTABLES in Flash + -DVTABLES_IN_FLASH +; restrict to minimal mime-types + -DMIMETYPE_MINIMAL + +[esp32] +build_flags = -w -g + -DARDUINO_ARCH_ESP32 + -DCONFIG_LITTLEFS_FOR_IDF_3_2 + +[scripts_defaults] +extra_scripts = pio/name-firmware.py + pio/gzip-firmware.py + pio/strip-floats.py + pio/user_config_copy.py # ------------------------------------------------------------------------------ # COMMON SETTINGS: @@ -155,8 +175,6 @@ framework = arduino board_build.flash_mode = dout monitor_speed = 115200 upload_speed = 115200 -lib_extra_dirs = - ${common.shared_libdeps_dir} # ------------------------------------------------------------------------------ # LIBRARIES: required dependencies @@ -187,6 +205,8 @@ lib_deps = lib_ignore = AsyncTCP +extra_scripts = ${scripts_defaults.extra_scripts} + # ------------------------------------------------------------------------------ # WLED BUILDS # ------------------------------------------------------------------------------ @@ -194,14 +214,18 @@ lib_ignore = [env:nodemcuv2] board = nodemcuv2 platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} # Unsupported environment due to insufficient flash [env:esp01] board = esp01 platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_512k} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA -D WLED_DISABLE_ALEXA -D WLED_DISABLE_BLYNK -D WLED_DISABLE_CRONIXIE -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_INFRARED -D WLED_DISABLE_MQTT -D WLED_DISABLE_WEBSOCKETS @@ -209,45 +233,58 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA -D WLED_DISABLE_ [env:esp01_1m_ota] board = esp01_1m platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_1m0m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_BLYNK -D WLED_DISABLE_CRONIXIE -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_INFRARED -D WLED_DISABLE_MQTT -D WLED_DISABLE_WEBSOCKETS [env:esp01_1m_full] board = esp01_1m platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_1m128k} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA [env:esp07] board = esp07 platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} [env:d1_mini] board = d1_mini platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} upload_speed = 921600 board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} monitor_filters = esp8266_exception_decoder [env:heltec_wifi_kit_8] board = d1_mini platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} [env:h803wf] board = d1_mini platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED [env:esp32dev] board = esp32dev -platform = espressif32@1.12.4 +platform = espressif32@2.0 +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} lib_ignore = ESPAsyncTCP @@ -255,35 +292,44 @@ lib_ignore = [env:esp32_poe] board = esp32-poe -platform = espressif32@1.12.4 +platform = espressif32@2.0 upload_speed = 921600 -build_flags = ${common.build_flags_esp32} ${common.debug_flags} -D RLYPIN=-1 -D WLED_USE_ETHERNET +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags_esp32} -D RLYPIN=-1 -D WLED_USE_ETHERNET lib_ignore = ESPAsyncTCP ESPAsyncUDP [env:esp8285_4CH_MagicHome] board = esp8285 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_1m0m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS [env:esp8285_4CH_H801] board = esp8285 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_1m0m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801 [env:esp8285_5CH_H801] board = esp8285 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_1m0m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801 -D WLED_ENABLE_5CH_LEDS [env:d1_mini_5CH_Shojo_PCB] board = d1_mini -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_USE_ANALOG_LEDS -D WLED_USE_SHOJO_PCB -D WLED_ENABLE_5CH_LEDS # ------------------------------------------------------------------------------ @@ -294,7 +340,9 @@ build_flags = ${common.build_flags_esp8266} -D WLED_USE_ANALOG_LEDS -D WLED_USE_ board = d1_mini build_type = debug platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} ${common.debug_flags} [env:d1_mini_ota] @@ -303,7 +351,9 @@ upload_protocol = espota # exchange for your WLED IP upload_port = "10.10.1.27" platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} # ------------------------------------------------------------------------------ @@ -312,38 +362,49 @@ build_flags = ${common.build_flags_esp8266} [env:custom_LEDPIN_4] board = d1_mini -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D LEDPIN=4 -D IRPIN=5 [env:custom_LEDPIN_16] board = d1_mini -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D LEDPIN=16 [env:custom_LEDPIN_3] board = d1_mini -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 [env:custom_APA102] board = d1_mini -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D USE_APA102 [env:custom_WS2801] board = d1_mini -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_4m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D USE_WS2801 [env:custom32_LEDPIN_16] board = esp32dev -platform = espressif32@1.12.4 +platform = espressif32@2.0 +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} -D LEDPIN=16 lib_ignore = ESPAsyncTCP @@ -351,7 +412,8 @@ lib_ignore = [env:custom32_TOUCHPIN_T0] board = esp32dev -platform = espressif32@1.12.4 +platform = espressif32@2.0 +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} -D TOUCHPIN=T0 lib_ignore = ESPAsyncTCP @@ -359,10 +421,11 @@ lib_ignore = [env:wemos_shield_esp32] board = esp32dev -platform = espressif32@1.12.4 +platform = espressif32@2.0 upload_port = /dev/cu.SLAB_USBtoUART monitor_port = /dev/cu.SLAB_USBtoUART upload_speed = 460800 +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} -D LEDPIN=16 -D RLYPIN=19 -D BTNPIN=17 lib_ignore = ESPAsyncTCP @@ -370,11 +433,12 @@ lib_ignore = [env:m5atom] board = esp32dev +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39 lib_ignore = ESPAsyncTCP ESPAsyncUDP -platform = espressif32@1.12.4 +platform = espressif32@2.0 [env:sp501e] board = esp_wroom_02 @@ -389,11 +453,13 @@ build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=1 [env:travis_esp8266] extends = env:d1_mini build_type = debug +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build_flags_all_features} [env:travis_esp32] extends = env:esp32dev ; build_type = debug +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features} # ------------------------------------------------------------------------------ @@ -403,35 +469,47 @@ build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_f [env:codm-controller-0.4] board = esp_wroom_02 platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_2m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 [env:codm-controller-0.4-WS2801] board = esp_wroom_02 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_2m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D USE_WS2801 -D CLKPIN=13 -D DATAPIN=3 [env:codm-controller-0.4-APA102] board = esp_wroom_02 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_2m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D USE_APA102 -D CLKPIN=13 -D DATAPIN=3 [env:codm-controller-0.5] board = esp_wroom_02 platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_2m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} [env:codm-controller-0.5-WS2801] board = esp_wroom_02 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_2m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D USE_WS2801 #-D CLKPIN=0 -D DATAPIN=2 [env:codm-controller-0.5-APA102] board = esp_wroom_02 -platform = ${common.platform_latest} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_2m1m} +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D USE_APA102 #-D CLKPIN=0 -D DATAPIN=2 diff --git a/platformio_override.ini.example b/platformio_override.ini.example index 240c486a..cf9da268 100644 --- a/platformio_override.ini.example +++ b/platformio_override.ini.example @@ -5,19 +5,26 @@ # Please visit documentation: https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = esp8266_1m_custom +default_envs = WLED_tasmota_1M -[env:esp8266_1m_custom] +[env:WLED_tasmota_1M] board = esp01_1m -platform = ${common.arduino_core_2_4_2} +platform = ${common.platform_wled_default} +platform_packages = ${common.platform_packages} board_build.ldscript = ${common.ldscript_1m0m} -build_flags = ${common.build_flags_esp8266} - -D WLED_DISABLE_OTA - -D WLED_DISABLE_ALEXA - -D WLED_DISABLE_BLYNK - -D WLED_DISABLE_CRONIXIE - -D WLED_DISABLE_HUESYNC - -D WLED_DISABLE_INFRARED +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags_esp8266} +; ********************************************************************* +; *** Use custom settings from file my_config.h + -DWLED_USE_MY_CONFIG +; ********************************************************************* +; -D WLED_DISABLE_OTA +; -D WLED_DISABLE_ALEXA +; -D WLED_DISABLE_BLYNK +; -D WLED_DISABLE_CRONIXIE +; -D WLED_DISABLE_HUESYNC +; -D WLED_DISABLE_INFRARED +; -D WLED_DISABLE_WEBSOCKETS ; PIN defines - uncomment and change, if needed: ; -D LEDPIN=2 ; -D BTNPIN=0 @@ -30,11 +37,11 @@ build_flags = ${common.build_flags_esp8266} ; -D USE_WS2801 ; -D USE_LPD8806 ; PIN defines for 2 wire LEDs -; -D CLKPIN=0 -; -D DATAPIN=2 + -D CLKPIN=0 + -D DATAPIN=2 ; to drive analog LED strips (aka 5050), uncomment the following ; PWM pins 5,12,13,15 are used with Magic Home LED Controller (default) -; -D WLED_USE_ANALOG_LEDS + -D WLED_USE_ANALOG_LEDS ; for the H801 controller (PINs 15,13,12,14 (W2 = 04)) uncomment this ; -D WLED_USE_H801 ; for the BW-LT11 controller (PINs 12,4,14,5 ) uncomment this diff --git a/readme.md b/readme.md index 9357e8a3..866db4aa 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,7 @@ +

diff --git a/wled00/FX.h b/wled00/FX.h index b61fd505..7ec99bfd 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -40,8 +40,12 @@ #define DEFAULT_INTENSITY (uint8_t)128 #define DEFAULT_COLOR (uint32_t)0xFFAA00 +#ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) +#endif /* Not used in all effects yet */ #define WLED_FPS 42 diff --git a/wled00/const.h b/wled00/const.h index 3afc3167..8dc1a286 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -149,8 +149,11 @@ #define NTP_PACKET_SIZE 48 -// maximum number of LEDs - MAX_LEDS is coming from the JSON response getting too big, MAX_LEDS_DMA will become a timing issue +// maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266 +#ifndef MAX_LEDS #define MAX_LEDS 1500 +#endif + #define MAX_LEDS_DMA 500 // string temp buffer (now stored in stack locally) diff --git a/wled00/my_config_sample.h b/wled00/my_config_sample.h new file mode 100644 index 00000000..fc54c1c5 --- /dev/null +++ b/wled00/my_config_sample.h @@ -0,0 +1,25 @@ +#pragma once + +/* + * Welcome! + * You can use the file "my_config.h" to make changes to the way WLED is compiled! + * It is possible to enable and disable certain features as well as set defaults for some runtime changeable settings. + * + * How to use: + * PlatformIO: Just compile the unmodified code once! The file "my_config.h" will be generated automatically and now you can make your changes. + * + * ArduinoIDE: Make a copy of this file and name it "my_config.h". Go to wled.h and uncomment "#define WLED_USE_MY_CONFIG" in the top of the file. + * + * DO NOT make changes to the "my_config_sample.h" file directly! Your changes will not be applied. + */ + +// force the compiler to show a warning to confirm that this file is included +#warning **** my_config.h: Settings from this file are honored **** + +/* Uncomment to use your WIFI settings as defaults + //WARNING: this will hardcode these as the default even after a factory reset +#define CLIENT_SSID "Your_SSID" +#define CLIENT_PASS "Your_Password" +*/ + +//#define MAX_LEDS 1500 //Maximum total LEDs. More than 1500 might create a low memory situation on ESP8266. \ No newline at end of file diff --git a/wled00/src/dependencies/e131/ESPAsyncE131.cpp b/wled00/src/dependencies/e131/ESPAsyncE131.cpp index 450dff57..8ba97106 100644 --- a/wled00/src/dependencies/e131/ESPAsyncE131.cpp +++ b/wled00/src/dependencies/e131/ESPAsyncE131.cpp @@ -18,7 +18,7 @@ */ #include "ESPAsyncE131.h" -#include "Network.h" +#include "../network/Network.h" #include // E1.17 ACN Packet Identifier diff --git a/wled00/src/dependencies/espalexa/Espalexa.h b/wled00/src/dependencies/espalexa/Espalexa.h index 10b61c08..cf42f9ff 100644 --- a/wled00/src/dependencies/espalexa/Espalexa.h +++ b/wled00/src/dependencies/espalexa/Espalexa.h @@ -47,7 +47,7 @@ #endif #endif #include -#include "Network.h" +#include "../network/Network.h" #ifdef ESPALEXA_DEBUG #pragma message "Espalexa 2.4.6 debug mode" @@ -583,7 +583,7 @@ public: return perc / 255; } - ~Espalexa(){delete devices;} //note: Espalexa is NOT meant to be destructed + ~Espalexa(){} //note: Espalexa is NOT meant to be destructed }; #endif diff --git a/wled00/src/dependencies/espalexa/EspalexaDevice.h b/wled00/src/dependencies/espalexa/EspalexaDevice.h index 0653a418..b7f2f184 100644 --- a/wled00/src/dependencies/espalexa/EspalexaDevice.h +++ b/wled00/src/dependencies/espalexa/EspalexaDevice.h @@ -4,7 +4,7 @@ #include "Arduino.h" #include -typedef class EspalexaDevice; +class EspalexaDevice; typedef std::function BrightnessCallbackFunction; typedef std::function DeviceCallbackFunction; diff --git a/wled00/Network.cpp b/wled00/src/dependencies/network/Network.cpp similarity index 100% rename from wled00/Network.cpp rename to wled00/src/dependencies/network/Network.cpp diff --git a/wled00/Network.h b/wled00/src/dependencies/network/Network.h similarity index 100% rename from wled00/Network.h rename to wled00/src/dependencies/network/Network.h diff --git a/wled00/wled.h b/wled00/wled.h index 65986b8d..768c0306 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -10,6 +10,9 @@ // version code in format yymmddb (b = daily build) #define VERSION 2011154 +//uncomment this if you have a "my_config.h" file you'd like to use +//#define WLED_USE_MY_CONFIG + // ESP8266-01 (blue) got too little storage space to work with WLED. 0.10.2 is the last release supporting this unit. // ESP8266-01 (black) has 1MB flash and can thus fit the whole program, although OTA update is not possible. Use 1M(128K SPIFFS). @@ -65,7 +68,11 @@ #include #endif -#include "Network.h" +#include "src/dependencies/network/Network.h" + +#ifdef WLED_USE_MY_CONFIG + #include "my_config.h" +#endif #include #include