From c73033c0b4d3cb92b618999074583b4fe4e73821 Mon Sep 17 00:00:00 2001 From: tonyn0 <59397047+tonyn0@users.noreply.github.com> Date: Wed, 16 Mar 2022 11:00:29 -0500 Subject: [PATCH 1/6] udp.cpp update added ap check for ddp in L657 --- wled00/udp.cpp | 2 +- wled00/wled.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/udp.cpp b/wled00/udp.cpp index 87e5177a8..02883f3fc 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -654,7 +654,7 @@ void sendSysInfoUDP() uint8_t sequenceNumber = 0; // this needs to be shared across all outputs uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8_t *buffer, uint8_t bri, bool isRGBW) { - if (!interfacesInited || !client[0] || !length) return 1; // network not initialised or dummy/unset IP address + if (!(apActive || interfacesInited) || !client[0] || !length) return 1; // network not initialised or dummy/unset IP address 031522 ajn added check for ap WiFiUDP ddpUdp; diff --git a/wled00/wled.h b/wled00/wled.h index a58c546e4..337177a1c 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2203150 +#define VERSION 2203151 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG From eaa20ff4bf7c9e297bee2ff794408b2d174a5a1a Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 16 Mar 2022 19:32:11 +0100 Subject: [PATCH 2/6] Add handleOverlayDraw() to example v2 usermod --- usermods/EXAMPLE_v2/usermod_v2_example.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/usermods/EXAMPLE_v2/usermod_v2_example.h b/usermods/EXAMPLE_v2/usermod_v2_example.h index 48fb7cd8e..a4fe93893 100644 --- a/usermods/EXAMPLE_v2/usermod_v2_example.h +++ b/usermods/EXAMPLE_v2/usermod_v2_example.h @@ -207,6 +207,17 @@ class MyExampleUsermod : public Usermod { return configComplete; } + + /* + * handleOverlayDraw() is called just before every show() (LED strip update frame) after effects have set the colors. + * Use this to blank out some LEDs or set them to a different color regardless of the set effect mode. + * Commonly used for custom clocks (Cronixie, 7 segment) + */ + void handleOverlayDraw() + { + //strip.setPixelColor(0, RGBW32(0,0,0,0)) // set the first pixel to black + } + /* * getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!). From 86010521798c1321f0bded6a4b4071ff51bb4fb2 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Fri, 18 Mar 2022 14:08:37 +0100 Subject: [PATCH 3/6] Fixed liveview buffer over-write (fixes #2586 ) (with odd LED counts > 256) --- wled00/ws.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wled00/ws.cpp b/wled00/ws.cpp index e33e7c760..35b214235 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -136,14 +136,15 @@ bool sendLiveLedsWs(uint32_t wsClient) uint16_t used = strip.getLengthTotal(); uint16_t n = ((used -1)/MAX_LIVE_LEDS_WS) +1; //only serve every n'th LED if count over MAX_LIVE_LEDS_WS - AsyncWebSocketMessageBuffer * wsBuf = ws.makeBuffer(2 + (used*3)/n); + uint16_t bufSize = 2 + (used/n)*3; + AsyncWebSocketMessageBuffer * wsBuf = ws.makeBuffer(bufSize); if (!wsBuf) return false; //out of memory uint8_t* buffer = wsBuf->get(); buffer[0] = 'L'; buffer[1] = 1; //version uint16_t pos = 2; - for (uint16_t i= 0; i < used; i += n) + for (uint16_t i= 0; pos < bufSize -3; i += n) { uint32_t c = strip.getPixelColor(i); buffer[pos++] = qadd8(W(c), R(c)); //R, add white channel to RGB channels as a simple RGBW -> RGB map From b93a9cb8bcf9df5e2be2fe705602cd606a3e5143 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Fri, 18 Mar 2022 14:24:10 +0100 Subject: [PATCH 4/6] FIxed liveview --- wled00/ws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 35b214235..a27ec6409 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -144,7 +144,7 @@ bool sendLiveLedsWs(uint32_t wsClient) buffer[1] = 1; //version uint16_t pos = 2; - for (uint16_t i= 0; pos < bufSize -3; i += n) + for (uint16_t i= 0; pos < bufSize -2; i += n) { uint32_t c = strip.getPixelColor(i); buffer[pos++] = qadd8(W(c), R(c)); //R, add white channel to RGB channels as a simple RGBW -> RGB map From d280e167238b11171353fa4befbece404066ebd8 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 19 Mar 2022 14:21:14 +0100 Subject: [PATCH 5/6] Fixed `/json/cfg` unable to set busses (fixes #2589) --- CHANGELOG.md | 5 +++++ wled00/FX_fcn.cpp | 1 + wled00/cfg.cpp | 4 +++- wled00/wled.cpp | 4 ++-- wled00/wled.h | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 977a5d849..399839483 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ### Builds after release 0.13.1 +#### Build 2203190 + +- Fixed `/json/cfg` unable to set busses (#2589) +- Fixed Peek with odd LED counts > 255 (#2586) + #### Build 2203160 - Version bump to v0.13.2-a0 "Toki" diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 35b6c07d8..a84eeb6f8 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -82,6 +82,7 @@ void WS2812FX::finalizeInit(void) //if busses failed to load, add default (fresh install, FS issue, ...) if (busses.getNumBusses() == 0) { + DEBUG_PRINTLN(F("No busses, init default")); const uint8_t defDataPins[] = {DATA_PINS}; const uint16_t defCounts[] = {PIXEL_COUNTS}; const uint8_t defNumBusses = ((sizeof defDataPins) / (sizeof defDataPins[0])); diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 4fb07fbc8..a7d60dd2a 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -116,7 +116,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { bool reversed = elm["rev"]; bool refresh = elm["ref"] | false; ledType |= refresh << 7; // hack bit 7 to indicate strip requires off refresh - s++; if (fromFS) { BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst); mem += BusManager::memUsage(bc); @@ -126,6 +125,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { busConfigs[s] = new BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst); doInitBusses = true; } + s++; } // finalization done in beginStrip() } @@ -455,7 +455,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { } if (fromFS) return needsSave; + // if from /json/cfg doReboot = doc[F("rb")] | doReboot; + if (doInitBusses) return false; // no save needed, will do after bus init in wled.cpp loop return (doc["sv"] | true); } diff --git a/wled00/wled.cpp b/wled00/wled.cpp index a98116954..942a9666b 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -28,7 +28,7 @@ void WLED::reset() yield(); // enough time to send response to client } applyBri(); - DEBUG_PRINTLN(F("MODULE RESET")); + DEBUG_PRINTLN(F("WLED RESET")); ESP.restart(); } @@ -152,7 +152,7 @@ void WLED::loop() yield(); - if (doReboot) + if (doReboot && !doInitBusses) // if busses have to be inited & saved, wait until next iteration reset(); if (doCloseFile) { closeFile(); diff --git a/wled00/wled.h b/wled00/wled.h index 468c7083c..db0593f9a 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2203160 +#define VERSION 2203190 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG From 9c9854b6bfa41b47ded553662e785c3b4daf6ded Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 19 Mar 2022 19:27:32 +0100 Subject: [PATCH 6/6] Fixed sunrise/set calculation --- CHANGELOG.md | 4 ++++ wled00/wled.h | 2 +- wled00/wled_math.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399839483..efbe90a57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ### Builds after release 0.13.1 +#### Build 2203191 + +- Fixed sunrise/set calculation (once again) + #### Build 2203190 - Fixed `/json/cfg` unable to set busses (#2589) diff --git a/wled00/wled.h b/wled00/wled.h index db0593f9a..11866f046 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2203190 +#define VERSION 2203191 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG diff --git a/wled00/wled_math.h b/wled00/wled_math.h index bfaff06a2..acdf3caa6 100644 --- a/wled00/wled_math.h +++ b/wled00/wled_math.h @@ -18,6 +18,7 @@ float cos_t(float phi) { float x = modd(phi, TWO_PI); + if (x < 0) x = -1 * x; int8_t sign = 1; if (x > PI) {