diff --git a/CHANGELOG.md b/CHANGELOG.md index 977a5d84..efbe90a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ### Builds after release 0.13.1 +#### Build 2203191 + +- Fixed sunrise/set calculation (once again) + +#### 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/usermods/EXAMPLE_v2/usermod_v2_example.h b/usermods/EXAMPLE_v2/usermod_v2_example.h index 48fb7cd8..a4fe9389 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!). diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index a86293e1..9fd81dea 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])); // min 1 diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index a3de0edc..e416dad3 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -119,7 +119,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { bool refresh = elm["ref"] | false; ledType |= refresh << 7; // hack bit 7 to indicate strip requires off refresh uint8_t AWmode = elm[F("rgbwm")] | autoWhiteMode; // backwards compatible - s++; if (fromFS) { BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst, AWmode); mem += BusManager::memUsage(bc); @@ -129,6 +128,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { busConfigs[s] = new BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst, AWmode); doInitBusses = true; } + s++; } // finalization done in beginStrip() } @@ -458,7 +458,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/udp.cpp b/wled00/udp.cpp index 35b14481..a9bb38bc 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -656,7 +656,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.cpp b/wled00/wled.cpp index 46aaee12..ec39a80a 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(); } @@ -71,7 +71,8 @@ void WLED::loop() yield(); - if (doReboot) reset(); + if (doReboot && !doInitBusses) // if busses have to be inited & saved, wait until next iteration + reset(); if (doCloseFile) { closeFile(); diff --git a/wled00/wled_math.cpp b/wled00/wled_math.cpp index 17d80e4f..623472dd 100644 --- a/wled00/wled_math.cpp +++ b/wled00/wled_math.cpp @@ -15,6 +15,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) { diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 170a0e23..64d8b388 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -140,14 +140,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 -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