Merge branch 'master' into master-merge

This commit is contained in:
Blaz Kristan 2022-03-19 21:05:28 +01:00
commit c14f16bdf1
8 changed files with 32 additions and 6 deletions

View File

@ -2,6 +2,15 @@
### Builds after release 0.13.1 ### 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 #### Build 2203160
- Version bump to v0.13.2-a0 "Toki" - Version bump to v0.13.2-a0 "Toki"

View File

@ -208,6 +208,17 @@ class MyExampleUsermod : public Usermod {
} }
/*
* 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!). * getId() allows you to optionally give your V2 usermod an unique ID (please define it in const.h!).
* This could be used in the future for the system to determine whether your usermod is installed. * This could be used in the future for the system to determine whether your usermod is installed.

View File

@ -82,6 +82,7 @@ void WS2812FX::finalizeInit(void)
//if busses failed to load, add default (fresh install, FS issue, ...) //if busses failed to load, add default (fresh install, FS issue, ...)
if (busses.getNumBusses() == 0) { if (busses.getNumBusses() == 0) {
DEBUG_PRINTLN(F("No busses, init default"));
const uint8_t defDataPins[] = {DATA_PINS}; const uint8_t defDataPins[] = {DATA_PINS};
const uint16_t defCounts[] = {PIXEL_COUNTS}; const uint16_t defCounts[] = {PIXEL_COUNTS};
const uint8_t defNumBusses = ((sizeof defDataPins) / (sizeof defDataPins[0])); // min 1 const uint8_t defNumBusses = ((sizeof defDataPins) / (sizeof defDataPins[0])); // min 1

View File

@ -119,7 +119,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
bool refresh = elm["ref"] | false; bool refresh = elm["ref"] | false;
ledType |= refresh << 7; // hack bit 7 to indicate strip requires off refresh ledType |= refresh << 7; // hack bit 7 to indicate strip requires off refresh
uint8_t AWmode = elm[F("rgbwm")] | autoWhiteMode; // backwards compatible uint8_t AWmode = elm[F("rgbwm")] | autoWhiteMode; // backwards compatible
s++;
if (fromFS) { if (fromFS) {
BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst, AWmode); BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst, AWmode);
mem += BusManager::memUsage(bc); 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); busConfigs[s] = new BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst, AWmode);
doInitBusses = true; doInitBusses = true;
} }
s++;
} }
// finalization done in beginStrip() // finalization done in beginStrip()
} }
@ -458,7 +458,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
} }
if (fromFS) return needsSave; if (fromFS) return needsSave;
// if from /json/cfg
doReboot = doc[F("rb")] | doReboot; 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); return (doc["sv"] | true);
} }

View File

@ -656,7 +656,7 @@ void sendSysInfoUDP()
uint8_t sequenceNumber = 0; // this needs to be shared across all outputs 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) { 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; WiFiUDP ddpUdp;

View File

@ -28,7 +28,7 @@ void WLED::reset()
yield(); // enough time to send response to client yield(); // enough time to send response to client
} }
applyBri(); applyBri();
DEBUG_PRINTLN(F("MODULE RESET")); DEBUG_PRINTLN(F("WLED RESET"));
ESP.restart(); ESP.restart();
} }
@ -71,7 +71,8 @@ void WLED::loop()
yield(); yield();
if (doReboot) reset(); if (doReboot && !doInitBusses) // if busses have to be inited & saved, wait until next iteration
reset();
if (doCloseFile) { if (doCloseFile) {
closeFile(); closeFile();

View File

@ -15,6 +15,7 @@
float cos_t(float phi) float cos_t(float phi)
{ {
float x = modd(phi, TWO_PI); float x = modd(phi, TWO_PI);
if (x < 0) x = -1 * x;
int8_t sign = 1; int8_t sign = 1;
if (x > PI) if (x > PI)
{ {

View File

@ -140,14 +140,15 @@ bool sendLiveLedsWs(uint32_t wsClient)
uint16_t used = strip.getLengthTotal(); 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 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 if (!wsBuf) return false; //out of memory
uint8_t* buffer = wsBuf->get(); uint8_t* buffer = wsBuf->get();
buffer[0] = 'L'; buffer[0] = 'L';
buffer[1] = 1; //version buffer[1] = 1; //version
uint16_t pos = 2; 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); 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 buffer[pos++] = qadd8(W(c), R(c)); //R, add white channel to RGB channels as a simple RGBW -> RGB map