From 3d89588eb11b6569dcb4275563b3ab20418b8a54 Mon Sep 17 00:00:00 2001 From: sunbowch Date: Fri, 27 Nov 2020 11:37:39 +0100 Subject: [PATCH 1/9] mutiple RGBW leds support for DMX control RGBW leds can be individually adressed through E1.31 control. -Added option 'Multi RGBW' to the settings -Modified e131.cpp accordingly -Tuned other parameters to make it work --- wled00/const.h | 1 + wled00/data/settings_sync.htm | 1 + wled00/e131.cpp | 22 ++++++++++++++++++++++ wled00/set.cpp | 2 +- wled00/wled.h | 2 +- 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/wled00/const.h b/wled00/const.h index 8dc1a2860..d7148a572 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -71,6 +71,7 @@ #define DMX_MODE_EFFECT 3 //trigger standalone effects of WLED (11 channels) #define DMX_MODE_MULTIPLE_RGB 4 //every LED is addressed with its own RGB (ledCount * 3 channels) #define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels) +#define DMX_MODE_MULTIPLE_RGBW 6 //every LED is addressed with its own RGBW (ledCount * 4 channels) //Light capability byte (unused) 0bRRCCTTTT //bits 0/1/2/3: specifies a type of LED driver. A single "driver" may have different chip models but must have the same protocol/behavior diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 89030c3c5..bd34c75fd 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -64,6 +64,7 @@ DMX mode: +
E1.31 info
Timeout: ms
diff --git a/wled00/e131.cpp b/wled00/e131.cpp index b4252d345..af0ae770a 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -185,6 +185,28 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ } break; } + case DMX_MODE_MULTIPLE_RGBW: //Implementation of RGBW leds + { + const byte dmxChannelsperLed=4; //4 DMX Channels/Led + const byte ledsPerUniverse=128; //Max.128 leds/Universe + realtimeLock(realtimeTimeoutMs, mde); + if (realtimeOverride) return; + uint16_t previousLeds, dmxOffset; + if (previousUniverses == 0) { + if (dmxChannels-DMXAddress < 1) return; + dmxOffset = DMXAddress; + previousLeds = 0; + } else{ + dmxOffset = (protocol == P_ARTNET) ? 0 : 1; + uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / dmxChannelsperLed; + previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * ledsPerUniverse; // Max leds/universe is only 128 with 4 Ch./led + } + uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsperLed; + for (uint16_t i = previousLeds; i < ledsTotal; i++) { + setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]); + } + break; + } default: DEBUG_PRINTLN(F("unknown E1.31 DMX mode")); return; // nothing to do diff --git a/wled00/set.cpp b/wled00/set.cpp index 96e0b85fd..2e9eff3af 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -152,7 +152,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) t = request->arg(F("DA")).toInt(); if (t >= 0 && t <= 510) DMXAddress = t; t = request->arg(F("DM")).toInt(); - if (t >= DMX_MODE_DISABLED && t <= DMX_MODE_MULTIPLE_DRGB) DMXMode = t; + if (t >= DMX_MODE_DISABLED && t <= DMX_MODE_MULTIPLE_RGBW) DMXMode = t; t = request->arg(F("ET")).toInt(); if (t > 99 && t <= 65000) realtimeTimeoutMs = t; arlsForceMaxBri = request->hasArg(F("FB")); diff --git a/wled00/wled.h b/wled00/wled.h index e2add60b2..61ff6a38b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -262,7 +262,7 @@ WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this #endif WLED_GLOBAL uint16_t e131Universe _INIT(1); // settings for E1.31 (sACN) protocol (only DMX_MODE_MULTIPLE_* can span over consequtive universes) WLED_GLOBAL uint16_t e131Port _INIT(5568); // DMX in port. E1.31 default is 5568, Art-Net is 6454 -WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGB); // DMX mode (s.a.) +WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGBW-1); // DMX mode (s.a.) WLED_GLOBAL uint16_t DMXAddress _INIT(1); // DMX start address of fixture, a.k.a. first Channel [for E1.31 (sACN) protocol] WLED_GLOBAL byte DMXOldDimmer _INIT(0); // only update brightness on change WLED_GLOBAL byte e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT]; // to detect packet loss From 55fd781c77e3315437bdc52b523af7c3483ff2a6 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Tue, 1 Dec 2020 00:38:26 +0100 Subject: [PATCH 2/9] Fixed compilation for analog (PWM) LEDs --- CHANGELOG.md | 4 ++++ wled00/FX_fcn.cpp | 4 ++-- wled00/wled.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91619a899..24c6becc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ### WLED version 0.11.0 +#### Build 2012010 + +- Fixed compilation for analog (PWM) LEDs + #### Build 2011290 - Release of WLED 0.11.0 "Mirai" diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index ddb49f6f0..4418cfb75 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -928,7 +928,7 @@ void WS2812FX::setRgbwPwm(void) { c.R = col >> 16; c.G = col >> 8; c.B = col; c.W = col >> 24; byte b = getBrightness(); - if (color == _analogLastColor && b == _analogLastBri) return; + if (c == _analogLastColor && b == _analogLastBri) return; // check color values for Warm / Cold white mix (for RGBW) // EsplanexaDevice.cpp #ifdef WLED_USE_5CH_LEDS @@ -948,7 +948,7 @@ void WS2812FX::setRgbwPwm(void) { #else bus->SetRgbwPwm(c.R * b / 255, c.G * b / 255, c.B * b / 255, c.W * b / 255); #endif - _analogLastColor = color; + _analogLastColor = c; _analogLastBri = b; } #else diff --git a/wled00/wled.h b/wled00/wled.h index f56bc1e87..93ca1378b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2011290 +#define VERSION 2012010 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG From dfb621627192dee841010dbd1b83b815e1de5720 Mon Sep 17 00:00:00 2001 From: broccoliboy Date: Tue, 1 Dec 2020 03:11:43 -0600 Subject: [PATCH 3/9] update to track core NpbWrapper.h (#1409) Co-authored-by: Sam Martin --- usermods/esp32_multistrip/NpbWrapper.h | 106 ++++++++++++++++++++----- 1 file changed, 85 insertions(+), 21 deletions(-) diff --git a/usermods/esp32_multistrip/NpbWrapper.h b/usermods/esp32_multistrip/NpbWrapper.h index b93242cf2..e468e46e2 100644 --- a/usermods/esp32_multistrip/NpbWrapper.h +++ b/usermods/esp32_multistrip/NpbWrapper.h @@ -41,6 +41,7 @@ #endif #include +#include "const.h" const uint8_t numStrips = NUM_STRIPS; // max 8 strips allowed on esp32 const uint16_t pixelCounts[numStrips] = {PIXEL_COUNTS}; // number of pixels on each strip @@ -190,7 +191,7 @@ public: } } - void SetPixelColor(uint16_t indexPixel, RgbwColor color) + void SetPixelColorRaw(uint16_t indexPixel, RgbwColor c) { // figure out which strip this pixel index is on uint8_t stripIdx = 0; @@ -211,17 +212,17 @@ public: { case NeoPixelType_Grb: { - RgbColor c = RgbColor(color.R, color.G, color.B); + RgbColor rgb = RgbColor(c.R, c.G, c.B); switch (stripIdx) { - case 0: pGrb0->SetPixelColor(indexPixel, c); break; - case 1: pGrb1->SetPixelColor(indexPixel, c); break; - case 2: pGrb2->SetPixelColor(indexPixel, c); break; - case 3: pGrb3->SetPixelColor(indexPixel, c); break; - case 4: pGrb4->SetPixelColor(indexPixel, c); break; - case 5: pGrb5->SetPixelColor(indexPixel, c); break; - case 6: pGrb6->SetPixelColor(indexPixel, c); break; - case 7: pGrb7->SetPixelColor(indexPixel, c); break; + case 0: pGrb0->SetPixelColor(indexPixel, rgb); break; + case 1: pGrb1->SetPixelColor(indexPixel, rgb); break; + case 2: pGrb2->SetPixelColor(indexPixel, rgb); break; + case 3: pGrb3->SetPixelColor(indexPixel, rgb); break; + case 4: pGrb4->SetPixelColor(indexPixel, rgb); break; + case 5: pGrb5->SetPixelColor(indexPixel, rgb); break; + case 6: pGrb6->SetPixelColor(indexPixel, rgb); break; + case 7: pGrb7->SetPixelColor(indexPixel, rgb); break; } break; } @@ -229,20 +230,48 @@ public: { switch (stripIdx) { - case 0: pGrbw0->SetPixelColor(indexPixel, color); break; - case 1: pGrbw1->SetPixelColor(indexPixel, color); break; - case 2: pGrbw2->SetPixelColor(indexPixel, color); break; - case 3: pGrbw3->SetPixelColor(indexPixel, color); break; - case 4: pGrbw4->SetPixelColor(indexPixel, color); break; - case 5: pGrbw5->SetPixelColor(indexPixel, color); break; - case 6: pGrbw6->SetPixelColor(indexPixel, color); break; - case 7: pGrbw7->SetPixelColor(indexPixel, color); break; + case 0: pGrbw0->SetPixelColor(indexPixel, c); break; + case 1: pGrbw1->SetPixelColor(indexPixel, c); break; + case 2: pGrbw2->SetPixelColor(indexPixel, c); break; + case 3: pGrbw3->SetPixelColor(indexPixel, c); break; + case 4: pGrbw4->SetPixelColor(indexPixel, c); break; + case 5: pGrbw5->SetPixelColor(indexPixel, c); break; + case 6: pGrbw6->SetPixelColor(indexPixel, c); break; + case 7: pGrbw7->SetPixelColor(indexPixel, c); break; } break; } } } + void SetPixelColor(uint16_t indexPixel, RgbwColor c) + { + /* + Set pixel color with necessary color order conversion. + */ + + RgbwColor col; + + uint8_t co = _colorOrder; + #ifdef COLOR_ORDER_OVERRIDE + if (indexPixel >= COO_MIN && indexPixel < COO_MAX) co = COO_ORDER; + #endif + + //reorder channels to selected order + switch (co) + { + case 0: col.G = c.G; col.R = c.R; col.B = c.B; break; //0 = GRB, default + case 1: col.G = c.R; col.R = c.G; col.B = c.B; break; //1 = RGB, common for WS2811 + case 2: col.G = c.B; col.R = c.R; col.B = c.G; break; //2 = BRG + case 3: col.G = c.R; col.R = c.B; col.B = c.G; break; //3 = RBG + case 4: col.G = c.B; col.R = c.G; col.B = c.R; break; //4 = BGR + default: col.G = c.G; col.R = c.B; col.B = c.R; break; //5 = GBR + } + col.W = c.W; + + SetPixelColorRaw(indexPixel, col); + } + void SetBrightness(byte b) { switch (_type) @@ -286,9 +315,17 @@ public: } } - // NOTE: Due to feature differences, some support RGBW but the method name - // here needs to be unique, thus GetPixeColorRgbw - RgbwColor GetPixelColorRgbw(uint16_t indexPixel) const + void SetColorOrder(byte colorOrder) + { + _colorOrder = colorOrder; + } + + uint8_t GetColorOrder() + { + return _colorOrder; + } + + RgbwColor GetPixelColorRaw(uint16_t indexPixel) const { // figure out which strip this pixel index is on uint8_t stripIdx = 0; @@ -339,8 +376,35 @@ public: return 0; } + // NOTE: Due to feature differences, some support RGBW but the method name + // here needs to be unique, thus GetPixeColorRgbw + uint32_t GetPixelColorRgbw(uint16_t indexPixel) const + { + RgbwColor col = GetPixelColorRaw(indexPixel); + uint8_t co = _colorOrder; + #ifdef COLOR_ORDER_OVERRIDE + if (indexPixel >= COO_MIN && indexPixel < COO_MAX) co = COO_ORDER; + #endif + + switch (co) + { + // W G R B + case 0: return ((col.W << 24) | (col.G << 8) | (col.R << 16) | (col.B)); //0 = GRB, default + case 1: return ((col.W << 24) | (col.R << 8) | (col.G << 16) | (col.B)); //1 = RGB, common for WS2811 + case 2: return ((col.W << 24) | (col.B << 8) | (col.R << 16) | (col.G)); //2 = BRG + case 3: return ((col.W << 24) | (col.B << 8) | (col.G << 16) | (col.R)); //3 = RBG + case 4: return ((col.W << 24) | (col.R << 8) | (col.B << 16) | (col.G)); //4 = BGR + case 5: return ((col.W << 24) | (col.G << 8) | (col.B << 16) | (col.R)); //5 = GBR + } + + return 0; + + } + + private: NeoPixelType _type; + byte _colorOrder = 0; uint16_t pixelStripStartIdx[numStrips]; From 3ba708b98d6006950adb9cd6cea65cfae75bfc35 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 1 Dec 2020 13:33:22 +0100 Subject: [PATCH 4/9] Silence Platformio setup warnings (#1413) * silence setup warnings * silence compile Option --- platformio.ini | 63 ++++++++++--------- ....example => platformio_override.ini.sample | 10 +-- 2 files changed, 38 insertions(+), 35 deletions(-) rename platformio_override.ini.example => platformio_override.ini.sample (92%) diff --git a/platformio.ini b/platformio.ini index c3cf2fc4e..9d5ea9bc5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,7 +37,7 @@ default_envs = travis_esp8266, travis_esp32 src_dir = ./wled00 data_dir = ./wled00/data build_cache_dir = ~/.buildcache -extra_configs = +extra_configs = platformio_override.ini [common] @@ -59,6 +59,9 @@ arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/ platform_wled_default = ${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 + platformio/toolchain-xtensa @ ~2.40802.200502 + platformio/tool-esptool @ ~1.413.0 + platformio/tool-esptoolpy @ ~1.30000.0 # ------------------------------------------------------------------------------ # FLAGS: DEBUG @@ -66,7 +69,7 @@ platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7 # ------------------------------------------------------------------------------ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM #if needed (for memleaks etc) also add; -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h" -#-DDEBUG_ESP_CORE is not working right now +#-DDEBUG_ESP_CORE is not working right now # ------------------------------------------------------------------------------ # FLAGS: ldscript (available ldscripts at https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld) @@ -104,23 +107,23 @@ build_flags = -Wno-return-type -Wno-sequence-point -Wno-narrowing - -Wno-reorder - -DMQTT_MAX_PACKET_SIZE=1024 - -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL + -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 + #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_SONY=true -D DECODE_SAMSUNG=true -D DECODE_LG=true -DWLED_USE_MY_CONFIG build_unflags = -Wall + -Wreorder -Wdeprecated-declarations # enables all features for travis CI @@ -136,15 +139,15 @@ build_flags_all_features = 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_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 [esp8266] -build_flags = +build_flags = -DESP8266 -DFP_IN_IROM ; NONOSDK22x_190703 = 2.2.2-dev(38a443e) @@ -154,9 +157,9 @@ build_flags = ; lwIP 1.4 - Higher Bandwidth (Aircoookie has) -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; VTABLES in Flash - -DVTABLES_IN_FLASH + -DVTABLES_IN_FLASH ; restrict to minimal mime-types - -DMIMETYPE_MINIMAL + -DMIMETYPE_MINIMAL [esp32] build_flags = -w -g @@ -187,15 +190,15 @@ upload_speed = 115200 # ------------------------------------------------------------------------------ lib_compat_mode = strict lib_deps = - FastLED@3.3.2 - NeoPixelBus@2.6.0 - ESPAsyncTCP@1.2.0 + fastled/FastLED @ 3.3.2 + NeoPixelBus @ 2.6.0 + ESPAsyncTCP @ 1.2.0 ESPAsyncUDP - AsyncTCP@1.0.3 - IRremoteESP8266@2.7.3 + AsyncTCP @ 1.0.3 + IRremoteESP8266 @ 2.7.3 https://github.com/lorol/LITTLEFS.git - https://github.com/Aircoookie/ESPAsyncWebServer.git@~2.0.0 - #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line + https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.0 + #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line #TFT_eSPI #For use SSD1306 OLED display uncomment following #U8g2@~2.27.2 @@ -228,7 +231,7 @@ 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 +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 # Unsupported environment due to insufficient flash @@ -255,7 +258,7 @@ 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} +build_flags = ${common.build_flags_esp8266} [env:d1_mini] board = d1_mini @@ -264,7 +267,7 @@ 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} +build_flags = ${common.build_flags_esp8266} monitor_filters = esp8266_exception_decoder [env:heltec_wifi_kit_8] @@ -287,7 +290,7 @@ build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED board = esp32dev platform = espressif32@2.0 build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags_esp32} +build_flags = ${common.build_flags_esp32} lib_ignore = ESPAsyncTCP ESPAsyncUDP @@ -324,7 +327,7 @@ 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 -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801 -D WLED_ENABLE_5CH_LEDS +build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801 -D WLED_ENABLE_5CH_LEDS [env:d1_mini_5CH_Shojo_PCB] board = d1_mini @@ -332,7 +335,7 @@ 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 +build_flags = ${common.build_flags_esp8266} -D WLED_USE_ANALOG_LEDS -D WLED_USE_SHOJO_PCB -D WLED_ENABLE_5CH_LEDS # ------------------------------------------------------------------------------ # DEVELOPMENT BOARDS @@ -356,7 +359,7 @@ 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} +build_flags = ${common.build_flags_esp8266} # ------------------------------------------------------------------------------ # custom board configurations @@ -376,7 +379,7 @@ 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 +build_flags = ${common.build_flags_esp8266} -D LEDPIN=16 [env:custom_LEDPIN_3] @@ -446,7 +449,7 @@ lib_ignore = board = esp32dev build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39 -lib_ignore = +lib_ignore = ESPAsyncTCP ESPAsyncUDP platform = espressif32@2.0 diff --git a/platformio_override.ini.example b/platformio_override.ini.sample similarity index 92% rename from platformio_override.ini.example rename to platformio_override.ini.sample index d486dff01..5d2d09bae 100644 --- a/platformio_override.ini.example +++ b/platformio_override.ini.sample @@ -18,13 +18,13 @@ 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_OTA +; -D WLED_DISABLE_ALEXA ; -D WLED_DISABLE_BLYNK -; -D WLED_DISABLE_CRONIXIE -; -D WLED_DISABLE_HUESYNC +; -D WLED_DISABLE_CRONIXIE +; -D WLED_DISABLE_HUESYNC ; -D WLED_DISABLE_INFRARED -; -D WLED_DISABLE_WEBSOCKETS +; -D WLED_DISABLE_WEBSOCKETS ; PIN defines - uncomment and change, if needed: ; -D LEDPIN=2 ; -D BTNPIN=0 From 88e0da765c768c48bc93855c0e2107ef25cab05d Mon Sep 17 00:00:00 2001 From: cschwinne Date: Tue, 1 Dec 2020 14:40:00 +0100 Subject: [PATCH 5/9] Remove code duplication for RGBW --- wled00/e131.cpp | 45 ++++++++++++++++-------------------------- wled00/html_settings.h | 3 ++- wled00/wled.h | 2 +- 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/wled00/e131.cpp b/wled00/e131.cpp index af0ae770a..58d63779c 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -1,6 +1,7 @@ #include "wled.h" -#define MAX_LEDS_PER_UNIVERSE 170 +#define MAX_3_CH_LEDS_PER_UNIVERSE 170 +#define MAX_4_CH_LEDS_PER_UNIVERSE 128 #define MAX_CHANNELS_PER_UNIVERSE 512 /* @@ -161,8 +162,12 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ case DMX_MODE_MULTIPLE_DRGB: case DMX_MODE_MULTIPLE_RGB: + case DMX_MODE_MULTIPLE_RGBW: { realtimeLock(realtimeTimeoutMs, mde); + bool is4Chan = (DMXMode == DMX_MODE_MULTIPLE_RGBW); + const uint16_t dmxChannelsPerLed = is4Chan ? 4 : 3; + const uint16_t ledsPerUniverse = is4Chan ? MAX_4_CH_LEDS_PER_UNIVERSE : MAX_3_CH_LEDS_PER_UNIVERSE; if (realtimeOverride) return; uint16_t previousLeds, dmxOffset; if (previousUniverses == 0) { @@ -176,37 +181,21 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ } else { // All subsequent universes start at the first channel. dmxOffset = (protocol == P_ARTNET) ? 0 : 1; - uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / 3; - previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * MAX_LEDS_PER_UNIVERSE; + uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / dmxChannelsPerLed; + previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * ledsPerUniverse; } - uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / 3; - for (uint16_t i = previousLeds; i < ledsTotal; i++) { - setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0); + uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsPerLed; + if (!is4Chan) { + for (uint16_t i = previousLeds; i < ledsTotal; i++) { + setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0); + } + } else { + for (uint16_t i = previousLeds; i < ledsTotal; i++) { + setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]); + } } break; } - case DMX_MODE_MULTIPLE_RGBW: //Implementation of RGBW leds - { - const byte dmxChannelsperLed=4; //4 DMX Channels/Led - const byte ledsPerUniverse=128; //Max.128 leds/Universe - realtimeLock(realtimeTimeoutMs, mde); - if (realtimeOverride) return; - uint16_t previousLeds, dmxOffset; - if (previousUniverses == 0) { - if (dmxChannels-DMXAddress < 1) return; - dmxOffset = DMXAddress; - previousLeds = 0; - } else{ - dmxOffset = (protocol == P_ARTNET) ? 0 : 1; - uint16_t ledsInFirstUniverse = (MAX_CHANNELS_PER_UNIVERSE - DMXAddress) / dmxChannelsperLed; - previousLeds = ledsInFirstUniverse + (previousUniverses - 1) * ledsPerUniverse; // Max leds/universe is only 128 with 4 Ch./led - } - uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsperLed; - for (uint16_t i = previousLeds; i < ledsTotal; i++) { - setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]); - } - break; - } default: DEBUG_PRINTLN(F("unknown E1.31 DMX mode")); return; // nothing to do diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 183a9e11c..23b840ca6 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -238,7 +238,8 @@ type="checkbox" name="ES">
DMX start address:
DMX mode:

E1.31 info
Timeout: ms
Force max brightness:
diff --git a/wled00/wled.h b/wled00/wled.h index 61ff6a38b..e2add60b2 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -262,7 +262,7 @@ WLED_GLOBAL uint16_t e131ProxyUniverse _INIT(0); // output this #endif WLED_GLOBAL uint16_t e131Universe _INIT(1); // settings for E1.31 (sACN) protocol (only DMX_MODE_MULTIPLE_* can span over consequtive universes) WLED_GLOBAL uint16_t e131Port _INIT(5568); // DMX in port. E1.31 default is 5568, Art-Net is 6454 -WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGBW-1); // DMX mode (s.a.) +WLED_GLOBAL byte DMXMode _INIT(DMX_MODE_MULTIPLE_RGB); // DMX mode (s.a.) WLED_GLOBAL uint16_t DMXAddress _INIT(1); // DMX start address of fixture, a.k.a. first Channel [for E1.31 (sACN) protocol] WLED_GLOBAL byte DMXOldDimmer _INIT(0); // only update brightness on change WLED_GLOBAL byte e131LastSequenceNumber[E131_MAX_UNIVERSE_COUNT]; // to detect packet loss From e5dd88cdce05ecf99611404755c52e86b191d981 Mon Sep 17 00:00:00 2001 From: Neil Enns Date: Wed, 2 Dec 2020 12:45:11 +0000 Subject: [PATCH 6/9] Add PlatformIO and npm install --- .devcontainer/devcontainer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 867d7d46d..f77dc4de4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -31,14 +31,15 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "ms-python.python" + "ms-python.python", + "platformio.platformio-ide" ], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pip3 install --user -r requirements.txt", + "postCreateCommand": "npm install", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" From bc96ca48b659718580244ccca9b2da56cd0f418d Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 2 Dec 2020 22:47:31 +0100 Subject: [PATCH 7/9] UDP `parsePacket()` with sync disabled --- CHANGELOG.md | 5 +++++ wled00/udp.cpp | 9 ++++++--- wled00/wled.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c6becc4..498410705 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ### WLED version 0.11.0 +#### Build 2012020 + +- UDP `parsePacket()` with sync disabled (#1390) +- Added Multi RGBW DMX mode (PR #1383) + #### Build 2012010 - Fixed compilation for analog (PWM) LEDs diff --git a/wled00/udp.cpp b/wled00/udp.cpp index 44b70ac02..2b098ac24 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -123,7 +123,7 @@ void handleNotifications() } //receive UDP notifications - if (!udpConnected || !(receiveNotifications || receiveDirect)) return; + if (!udpConnected) return; bool isSupp = false; uint16_t packetSize = notifierUdp.parsePacket(); @@ -155,16 +155,18 @@ void handleNotifications() return; } } + + if (!(receiveNotifications || receiveDirect)) return; //notifier and UDP realtime if (!packetSize || packetSize > UDP_IN_MAXSIZE) return; - if (!isSupp && notifierUdp.remoteIP() == Network.localIP()) return; //don't process broadcasts we send ourselves + if (!isSupp && notifierUdp.remoteIP() == Network.localIP()) return; //don't process broadcasts we send ourselves uint8_t udpIn[packetSize +1]; if (isSupp) notifier2Udp.read(udpIn, packetSize); else notifierUdp.read(udpIn, packetSize); - //wled notifier, block if realtime packets active + //wled notifier, ignore if realtime packets active if (udpIn[0] == 0 && !realtimeMode && receiveNotifications) { //ignore notification if received within a second after sending a notification ourselves @@ -223,6 +225,7 @@ void handleNotifications() colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); return; } + if (!receiveDirect) return; //TPM2.NET diff --git a/wled00/wled.h b/wled00/wled.h index 93ca1378b..8915bbcd9 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2012010 +#define VERSION 2012020 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG From 938eefae9b6f4a8d907fbcdc7d9da9cdeebd30dc Mon Sep 17 00:00:00 2001 From: danecreekphotography Date: Fri, 4 Dec 2020 00:55:30 -0800 Subject: [PATCH 8/9] Add VSCode build tasks (#1421) * Add VSCode build tasks * Split to two build tasks * Add combined task --- .vscode/tasks.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..2ee772ce1 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build: HTML and binary", + "dependsOn": [ + "Build: HTML only", + "Build: binary only" + ], + "dependsOrder": "sequence", + "problemMatcher": [ + "$platformio", + ], + }, + { + "type": "PlatformIO", + "label": "Build: binary only", + "task": "Build", + "group": { + "kind": "build", + "isDefault": true, + }, + "problemMatcher": [ + "$platformio" + ], + "presentation": { + "panel": "shared" + } + }, + { + "type": "npm", + "script": "build", + "group": "build", + "problemMatcher": [], + "label": "Build: HTML only", + "detail": "npm run build", + "presentation": { + "panel": "shared" + } + } + ] +} \ No newline at end of file From aab2e4555a2dafd66cd2e52b506f1a8db0b53034 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 4 Dec 2020 02:01:41 -0700 Subject: [PATCH 9/9] Added Temperature Palette (#1430) * Added Temperature Palette Added cpt-city temperature_gp palette. Palette is nice combination of blues to reds to yellows. Reduced original cpt-city palette to 18 lines to fit WLED constraints. Tested palette and it visually is consistent with original cpt-city colors and look and works in WLED. * Update palettes.h * Update palettes.h --- wled00/FX.h | 2 +- wled00/palettes.h | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/wled00/FX.h b/wled00/FX.h index 6e0b46435..ae9b1811a 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -741,7 +741,7 @@ const char JSON_palette_names[] PROGMEM = R"=====([ "Pastel","Sunset 2","Beech","Vintage","Departure","Landscape","Beach","Sherbet","Hult","Hult 64", "Drywet","Jul","Grintage","Rewhi","Tertiary","Fire","Icefire","Cyane","Light Pink","Autumn", "Magenta","Magred","Yelmag","Yelblu","Orange & Teal","Tiamat","April Night","Orangery","C9","Sakura", -"Aurora","Atlantica","C9 2","C9 New" +"Aurora","Atlantica","C9 2","C9 New","Temperature" ])====="; #endif diff --git a/wled00/palettes.h b/wled00/palettes.h index 30d28433f..1753ea79e 100644 --- a/wled00/palettes.h +++ b/wled00/palettes.h @@ -13,7 +13,7 @@ #ifndef PalettesWLED_h #define PalettesWLED_h -#define GRADIENT_PALETTE_COUNT 41 +#define GRADIENT_PALETTE_COUNT 42 const byte ib_jul01_gp[] PROGMEM = { 0, 194, 1, 1, @@ -606,6 +606,30 @@ const byte Atlantica_gp[] PROGMEM = { 180, 4, 30, 114, //blue (start 191?) 255, 4, 30, 114}; +// Gradient palette "temperature_gp", originally from +// http://soliton.vm.bytemark.co.uk/pub/cpt-city/arendal/tn/temperature.png.index.html +// converted for FastLED with gammas (2.6, 2.2, 2.5) +// Size: 144 bytes of program space. + +const byte temperature_gp[] PROGMEM = { + 0, 1, 27,105, + 14, 1, 40,127, + 28, 1, 70,168, + 42, 1, 92,197, + 56, 1,119,221, + 70, 3,130,151, + 84, 23,156,149, + 99, 67,182,112, + 113, 121,201, 52, + 127, 142,203, 11, + 141, 224,223, 1, + 155, 252,187, 2, + 170, 247,147, 1, + 184, 237, 87, 1, + 198, 229, 43, 1, + 226, 171, 2, 2, + 240, 80, 3, 3, + 255, 80, 3, 3}; // Single array of defined cpt-city color palettes. // This will let us programmatically choose one based on @@ -652,7 +676,8 @@ const byte* const gGradientPalettes[] PROGMEM = { Aurora_gp, //50-37 Aurora Atlantica_gp, //51-38 Atlantica C9_2_gp, //52-39 C9 2 - C9_new_gp //53-40 C9 New + C9_new_gp, //53-40 C9 New + temperature_gp //54-41 Temperature }; #endif