From de4ff4e58d1644d091c072ae32ca0f8ac4581a49 Mon Sep 17 00:00:00 2001 From: strikeout Date: Thu, 16 Mar 2023 17:56:29 +0100 Subject: [PATCH 1/7] Fixes preset and brightness selection via DMX controller to DoS WLED, now same packets are discarded --- wled00/e131.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wled00/e131.cpp b/wled00/e131.cpp index ababf8d8..5be7472f 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -174,10 +174,20 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ case DMX_MODE_PRESET: // 2 channel: [Dimmer,Preset] if (uni != e131Universe || availDMXLen < 2) return; - applyPreset(e131_data[dataOffset+1], CALL_MODE_NOTIFICATION); - if (bri != e131_data[dataOffset]) { + + // only apply preset if value changed + if (currentPreset != e131_data[dataOffset+1] && e131_data[dataOffset+1] != 0 && + // only apply preset if not in playlist, or playlist changed + (currentPlaylist < 0 || currentPlaylist != e131_data[dataOffset+1])) { + presetCycCurr = e131_data[dataOffset+1]; + unloadPlaylist(); // applying a preset unloads the playlist + applyPreset(e131_data[dataOffset+1], CALL_MODE_NOTIFICATION); + } + // only change brightness if value changed + if (bri != e131_data[dataOffset]) { bri = e131_data[dataOffset]; - strip.setBrightness(bri, true); + strip.setBrightness(scaledBri(bri), false); + stateUpdated(CALL_MODE_WS_SEND); } return; break; From 56a854ec88c60abddb58a19eae8aac8904a3a3bd Mon Sep 17 00:00:00 2001 From: strikeout Date: Fri, 17 Mar 2023 13:40:21 +0100 Subject: [PATCH 2/7] limit max. selectable preset ID to 250, according to WLED capabilities --- wled00/e131.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/wled00/e131.cpp b/wled00/e131.cpp index 5be7472f..1c16e148 100644 --- a/wled00/e131.cpp +++ b/wled00/e131.cpp @@ -173,24 +173,30 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){ break; case DMX_MODE_PRESET: // 2 channel: [Dimmer,Preset] - if (uni != e131Universe || availDMXLen < 2) return; + { + if (uni != e131Universe || availDMXLen < 2) return; - // only apply preset if value changed - if (currentPreset != e131_data[dataOffset+1] && e131_data[dataOffset+1] != 0 && - // only apply preset if not in playlist, or playlist changed - (currentPlaylist < 0 || currentPlaylist != e131_data[dataOffset+1])) { - presetCycCurr = e131_data[dataOffset+1]; - unloadPlaylist(); // applying a preset unloads the playlist - applyPreset(e131_data[dataOffset+1], CALL_MODE_NOTIFICATION); + // limit max. selectable preset to 250, even though DMX max. val is 255 + uint8_t dmxValPreset = (e131_data[dataOffset+1] > 250 ? 250 : e131_data[dataOffset+1]); + + // only apply preset if value changed + if (dmxValPreset != 0 && dmxValPreset != currentPreset && + // only apply preset if not in playlist, or playlist changed + (currentPlaylist < 0 || dmxValPreset != currentPlaylist)) { + presetCycCurr = dmxValPreset; + unloadPlaylist(); // applying a preset unloads the playlist + applyPreset(dmxValPreset, CALL_MODE_NOTIFICATION); + } + + // only change brightness if value changed + if (bri != e131_data[dataOffset]) { + bri = e131_data[dataOffset]; + strip.setBrightness(scaledBri(bri), false); + stateUpdated(CALL_MODE_WS_SEND); + } + return; + break; } - // only change brightness if value changed - if (bri != e131_data[dataOffset]) { - bri = e131_data[dataOffset]; - strip.setBrightness(scaledBri(bri), false); - stateUpdated(CALL_MODE_WS_SEND); - } - return; - break; case DMX_MODE_EFFECT: // 15 channels [bri,effectCurrent,effectSpeed,effectIntensity,effectPalette,effectOption,R,G,B,R2,G2,B2,R3,G3,B3] case DMX_MODE_EFFECT_W: // 18 channels, same as above but with extra +3 white channels [..,W,W2,W3] From 274f5f2f1feac133b920c314fc48efc056e565f4 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sat, 22 Apr 2023 16:06:13 +0200 Subject: [PATCH 3/7] Bugfix. --- wled00/udp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/udp.cpp b/wled00/udp.cpp index afe7b335..5b7d15fd 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -771,7 +771,7 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8 // write the colors, the write write(const uint8_t *buffer, size_t size) // function is just a loop internally too - for (size_t i = 0; i < packetSize; i += 3) { + for (size_t i = 0; i < packetSize; i += (isRGBW?4:3)) { ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // R ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // G ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // B From 468ed1a9ce9d3758e95ac851131e4e0c3957675c Mon Sep 17 00:00:00 2001 From: Christian Schwinne Date: Wed, 26 Apr 2023 10:52:54 +0200 Subject: [PATCH 4/7] Restore Github actions CI build (#3187) * Update dependencies * Do not fail fast * Disable ESP32 variant CI builds --- .github/workflows/wled-ci.yml | 21 +++++++++------ platformio.ini | 7 +++-- requirements.txt | 48 ++++++++++++++++------------------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/.github/workflows/wled-ci.yml b/.github/workflows/wled-ci.yml index c28446e6..2b599e6f 100644 --- a/.github/workflows/wled-ci.yml +++ b/.github/workflows/wled-ci.yml @@ -8,21 +8,23 @@ jobs: name: Gather Environments runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 + with: + python-version: '3.9' - name: Install PlatformIO run: pip install -r requirements.txt - name: Get default environments id: envs run: | - echo "::set-output name=environments::$(pio project config --json-output | jq -cr '.[0][1][0][1]')" + echo "environments=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT outputs: environments: ${{ steps.envs.outputs.environments }} @@ -32,24 +34,27 @@ jobs: runs-on: ubuntu-latest needs: get_default_envs strategy: + fail-fast: false matrix: environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache PlatformIO - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.platformio key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.9' - name: Install PlatformIO run: pip install -r requirements.txt - name: Build firmware diff --git a/platformio.ini b/platformio.ini index a20dab2c..637e1d55 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,8 +9,11 @@ # (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example) # ------------------------------------------------------------------------------ -# Release / CI binaries -default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s2_saola, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB +# CI binaries +ci_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth # ESP32 variant builds are temporarily excluded from CI due to toolchain issues on the GitHub Actions Linux environment + +# Release binaries +default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB # Build everything ; default_envs = esp32dev, esp8285_4CH_MagicHome, codm-controller-0.6-rev2, codm-controller-0.6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips diff --git a/requirements.txt b/requirements.txt index e484d7bc..da65486c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,63 +4,59 @@ # # pip-compile # -aiofiles==0.8.0 +aiofiles==22.1.0 # via platformio ajsonrpc==1.2.0 # via platformio -anyio==3.6.1 +anyio==3.6.2 # via starlette -async-timeout==4.0.2 - # via zeroconf -bottle==0.12.23 +bottle==0.12.25 # via platformio certifi==2022.12.7 # via requests -charset-normalizer==2.1.1 +charset-normalizer==3.1.0 # via requests click==8.1.3 # via # platformio # uvicorn -colorama==0.4.5 - # via platformio -h11==0.13.0 +colorama==0.4.6 + # via + # click + # platformio +h11==0.14.0 # via # uvicorn # wsproto -idna==3.3 +idna==3.4 # via # anyio # requests -ifaddr==0.2.0 - # via zeroconf -marshmallow==3.17.0 +marshmallow==3.19.0 # via platformio -packaging==21.3 +packaging==23.1 # via marshmallow -platformio==6.1.4 +platformio==6.1.6 # via -r requirements.in pyelftools==0.29 # via platformio -pyparsing==3.0.9 - # via packaging pyserial==3.5 # via platformio -requests==2.28.1 +requests==2.28.2 # via platformio semantic-version==2.10.0 # via platformio -sniffio==1.2.0 +sniffio==1.3.0 # via anyio -starlette==0.20.4 +starlette==0.23.1 # via platformio -tabulate==0.8.10 +tabulate==0.9.0 # via platformio -urllib3==1.26.11 +typing-extensions==4.5.0 + # via starlette +urllib3==1.26.15 # via requests -uvicorn==0.18.2 +uvicorn==0.20.0 # via platformio -wsproto==1.1.0 - # via platformio -zeroconf==0.39.0 +wsproto==1.2.0 # via platformio From 3a28935bfef5263d7985882b9dc62253c96f7b41 Mon Sep 17 00:00:00 2001 From: Stefan Riese Date: Wed, 26 Apr 2023 10:53:18 +0200 Subject: [PATCH 5/7] Wordclock - Issue with "Norddeutsch" (#3161) * - fix word clock for "viertel vor" and "viertel nach" - adjust wording of parameters * - revert changes for parameter names * enclose JSON property strings in F() macro to reduce RAM usage. * add parameter info for "norddeutsch" and "LedOffset" --- .../usermod_v2_word_clock.h | 93 ++++++++++--------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/usermods/usermod_v2_word_clock/usermod_v2_word_clock.h b/usermods/usermod_v2_word_clock/usermod_v2_word_clock.h index c825a7af..058b8318 100644 --- a/usermods/usermod_v2_word_clock/usermod_v2_word_clock.h +++ b/usermods/usermod_v2_word_clock/usermod_v2_word_clock.h @@ -40,39 +40,39 @@ class WordClockUsermod : public Usermod // Normal wiring const int maskMinutes[14][maskSizeMinutes] = { - {107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00 - { 7, 8, 9, 10, 40, 41, 42, 43, -1, -1, -1, -1}, // :05 fünf nach - { 11, 12, 13, 14, 40, 41, 42, 43, -1, -1, -1, -1}, // :10 zehn nach - { 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1}, // :15 viertel - { 15, 16, 17, 18, 19, 20, 21, 40, 41, 42, 43, -1}, // :20 zwanzig nach - { 7, 8, 9, 10, 33, 34, 35, 44, 45, 46, 47, -1}, // :25 fünf vor halb - { 44, 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, -1}, // :30 halb - { 7, 8, 9, 10, 40, 41, 42, 43, 44, 45, 46, 47}, // :35 fünf nach halb - { 15, 16, 17, 18, 19, 20, 21, 33, 34, 35, -1, -1}, // :40 zwanzig vor - { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // :45 dreiviertel - { 11, 12, 13, 14, 33, 34, 35, -1, -1, -1, -1, -1}, // :50 zehn vor - { 7, 8, 9, 10, 33, 34, 35, -1, -1, -1, -1, -1}, // :55 fünf vor - { 26, 27, 28, 29, 30, 31, 32, 40, 41, 42, 43, -1}, // :15 alternative viertel nach - { 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1} // :45 alternative viertel vor + {107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // 0 - 00 + { 7, 8, 9, 10, 40, 41, 42, 43, -1, -1, -1, -1}, // 1 - 05 fünf nach + { 11, 12, 13, 14, 40, 41, 42, 43, -1, -1, -1, -1}, // 2 - 10 zehn nach + { 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1}, // 3 - 15 viertel + { 15, 16, 17, 18, 19, 20, 21, 40, 41, 42, 43, -1}, // 4 - 20 zwanzig nach + { 7, 8, 9, 10, 33, 34, 35, 44, 45, 46, 47, -1}, // 5 - 25 fünf vor halb + { 44, 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, -1}, // 6 - 30 halb + { 7, 8, 9, 10, 40, 41, 42, 43, 44, 45, 46, 47}, // 7 - 35 fünf nach halb + { 15, 16, 17, 18, 19, 20, 21, 33, 34, 35, -1, -1}, // 8 - 40 zwanzig vor + { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // 9 - 45 dreiviertel + { 11, 12, 13, 14, 33, 34, 35, -1, -1, -1, -1, -1}, // 10 - 50 zehn vor + { 7, 8, 9, 10, 33, 34, 35, -1, -1, -1, -1, -1}, // 11 - 55 fünf vor + { 26, 27, 28, 29, 30, 31, 32, 40, 41, 42, 43, -1}, // 12 - 15 alternative viertel nach + { 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1} // 13 - 45 alternative viertel vor }; // Meander wiring const int maskMinutesMea[14][maskSizeMinutesMea] = { - { 99, 100, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00 - { 7, 8, 9, 10, 33, 34, 35, 36, -1, -1, -1, -1}, // :05 fünf nach - { 18, 19, 20, 21, 33, 34, 35, 36, -1, -1, -1, -1}, // :10 zehn nach - { 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1}, // :15 viertel - { 11, 12, 13, 14, 15, 16, 17, 33, 34, 35, 36, -1}, // :20 zwanzig nach - { 7, 8, 9, 10, 41, 42, 43, 44, 45, 46, 47, -1}, // :25 fünf vor halb - { 44, 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, -1}, // :30 halb - { 7, 8, 9, 10, 33, 34, 35, 36, 44, 45, 46, 47}, // :35 fünf nach halb - { 11, 12, 13, 14, 15, 16, 17, 41, 42, 43, -1, -1}, // :40 zwanzig vor - { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // :45 dreiviertel - { 18, 19, 20, 21, 41, 42, 43, -1, -1, -1, -1, -1}, // :50 zehn vor - { 7, 8, 9, 10, 41, 42, 43, -1, -1, -1, -1, -1}, // :55 fünf vor - { 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1}, // :15 alternative viertel nach - { 26, 27, 28, 29, 30, 31, 32, 41, 42, 43, -1, -1} // :45 alternative viertel vor + { 99, 100, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // 0 - 00 + { 7, 8, 9, 10, 33, 34, 35, 36, -1, -1, -1, -1}, // 1 - 05 fünf nach + { 18, 19, 20, 21, 33, 34, 35, 36, -1, -1, -1, -1}, // 2 - 10 zehn nach + { 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1}, // 3 - 15 viertel + { 11, 12, 13, 14, 15, 16, 17, 33, 34, 35, 36, -1}, // 4 - 20 zwanzig nach + { 7, 8, 9, 10, 41, 42, 43, 44, 45, 46, 47, -1}, // 5 - 25 fünf vor halb + { 44, 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, -1}, // 6 - 30 halb + { 7, 8, 9, 10, 33, 34, 35, 36, 44, 45, 46, 47}, // 7 - 35 fünf nach halb + { 11, 12, 13, 14, 15, 16, 17, 41, 42, 43, -1, -1}, // 8 - 40 zwanzig vor + { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // 9 - 45 dreiviertel + { 18, 19, 20, 21, 41, 42, 43, -1, -1, -1, -1, -1}, // 10 - 50 zehn vor + { 7, 8, 9, 10, 41, 42, 43, -1, -1, -1, -1, -1}, // 11 - 55 fünf vor + { 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1}, // 12 - 15 alternative viertel nach + { 26, 27, 28, 29, 30, 31, 32, 41, 42, 43, -1, -1} // 13 - 45 alternative viertel vor }; @@ -284,12 +284,13 @@ class WordClockUsermod : public Usermod setHours(hours + 1, false); break; case 9: - // viertel vor bzw dreiviertel + // viertel vor if (nord) { - setMinutes(9); + setMinutes(13); } + // dreiviertel else { - setMinutes(12); + setMinutes(9); } setHours(hours + 1, false); break; @@ -422,12 +423,18 @@ class WordClockUsermod : public Usermod */ void addToConfig(JsonObject& root) { - JsonObject top = root.createNestedObject("WordClockUsermod"); - top["active"] = usermodActive; - top["displayItIs"] = displayItIs; - top["ledOffset"] = ledOffset; - top["Meander wiring?"] = meander; - top["Norddeutsch"] = nord; + JsonObject top = root.createNestedObject(F("WordClockUsermod")); + top[F("active")] = usermodActive; + top[F("displayItIs")] = displayItIs; + top[F("ledOffset")] = ledOffset; + top[F("Meander wiring?")] = meander; + top[F("Norddeutsch")] = nord; + } + + void appendConfigData() + { + oappend(SET_F("addInfo('WordClockUsermod:ledOffset', 1, 'Number of LEDs before the letters');")); + oappend(SET_F("addInfo('WordClockUsermod:Norddeutsch', 1, 'Viertel vor instead of Dreiviertel');")); } /* @@ -450,15 +457,15 @@ class WordClockUsermod : public Usermod // default settings values could be set here (or below using the 3-argument getJsonValue()) instead of in the class definition or constructor // setting them inside readFromConfig() is slightly more robust, handling the rare but plausible use case of single value being missing after boot (e.g. if the cfg.json was manually edited and a value was removed) - JsonObject top = root["WordClockUsermod"]; + JsonObject top = root[F("WordClockUsermod")]; bool configComplete = !top.isNull(); - configComplete &= getJsonValue(top["active"], usermodActive); - configComplete &= getJsonValue(top["displayItIs"], displayItIs); - configComplete &= getJsonValue(top["ledOffset"], ledOffset); - configComplete &= getJsonValue(top["Meander wiring?"], meander); - configComplete &= getJsonValue(top["Norddeutsch"], nord); + configComplete &= getJsonValue(top[F("active")], usermodActive); + configComplete &= getJsonValue(top[F("displayItIs")], displayItIs); + configComplete &= getJsonValue(top[F("ledOffset")], ledOffset); + configComplete &= getJsonValue(top[F("Meander wiring?")], meander); + configComplete &= getJsonValue(top[F("Norddeutsch")], nord); return configComplete; } From 695b073080ab42618ba2d437ed4869909045f921 Mon Sep 17 00:00:00 2001 From: Marcos Castro Date: Wed, 26 Apr 2023 10:53:49 +0200 Subject: [PATCH 6/7] Apply correct iOS scroll to all tabcontent (#3182) --- wled00/data/index.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/wled00/data/index.css b/wled00/data/index.css index 32745460..b5be43cc 100644 --- a/wled00/data/index.css +++ b/wled00/data/index.css @@ -318,9 +318,6 @@ button { height: 100%; overscroll-behavior: none; padding: 0 4px; -} - -#Effects { -webkit-overflow-scrolling: touch; } From 5e2fa1347109999712ffd05ef03924b33e74e3ce Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Wed, 26 Apr 2023 19:47:12 +0200 Subject: [PATCH 7/7] Bugfix. - allow saving of reboot preset - return Spread slider --- wled00/FX.cpp | 2 +- wled00/json.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 2b5c8141..b5949d00 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -2765,7 +2765,7 @@ uint16_t mode_spots() { return spots_base((255 - SEGMENT.speed) << 8); } -static const char _data_FX_MODE_SPOTS[] PROGMEM = "Spots@,Width,,,,,Overlay;!,!;!"; +static const char _data_FX_MODE_SPOTS[] PROGMEM = "Spots@Spread,Width,,,,,Overlay;!,!;!"; //Intensity slider sets number of "lights", LEDs per light fade in and out diff --git a/wled00/json.cpp b/wled00/json.cpp index 77d89f17..60a74f62 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -338,7 +338,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) if (presetsModifiedTime == 0) presetsModifiedTime = timein; } - doReboot = root[F("rb")] | doReboot; + if (root[F("psave")].isNull()) doReboot = root[F("rb")] | doReboot; // do not allow changing main segment while in realtime mode (may get odd results else) if (!realtimeMode) strip.setMainSegmentId(root[F("mainseg")] | strip.getMainSegmentId()); // must be before realtimeLock() if "live"