Removed STATUSLED

Fix for possible Drip effect ESP reboot.
This commit is contained in:
Blaz Kristan 2021-04-06 22:30:23 +02:00
parent 31ea032054
commit c901512db0
5 changed files with 39 additions and 20 deletions

View File

@ -1,5 +1,12 @@
## WLED changelog ## WLED changelog
### Builds after release 0.12.0
#### Build 2104030
- Fixed ESP32 crash on Drip effect with reversed segment (#1854)
- Added flag `WLED_DISABLE_BROWNOUT_DET` to disable ESP32 brownout detector (off by default)
#### Build 2104020 #### Build 2104020
- Allow clearing button/IR/relay pin on platforms that don't support negative numbers - Allow clearing button/IR/relay pin on platforms that don't support negative numbers

View File

@ -3034,7 +3034,7 @@ uint16_t WS2812FX::mode_exploding_fireworks(void)
uint16_t WS2812FX::mode_drip(void) uint16_t WS2812FX::mode_drip(void)
{ {
//allocate segment data //allocate segment data
uint16_t numDrops = 4; uint8_t numDrops = 4;
uint16_t dataSize = sizeof(spark) * numDrops; uint16_t dataSize = sizeof(spark) * numDrops;
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
@ -3042,13 +3042,13 @@ uint16_t WS2812FX::mode_drip(void)
Spark* drops = reinterpret_cast<Spark*>(SEGENV.data); Spark* drops = reinterpret_cast<Spark*>(SEGENV.data);
numDrops = 1 + (SEGMENT.intensity >> 6); numDrops = 1 + (SEGMENT.intensity >> 6); // 255>>6 = 3
float gravity = -0.001 - (SEGMENT.speed/50000.0); float gravity = -0.001 - (SEGMENT.speed/50000.0);
gravity *= SEGLEN; gravity *= SEGLEN;
int sourcedrop = 12; int sourcedrop = 12;
for (int j=0;j<numDrops;j++) { for (uint8_t j=0;j<numDrops;j++) {
if (drops[j].colIndex == 0) { //init if (drops[j].colIndex == 0) { //init
drops[j].pos = SEGLEN-1; // start at end drops[j].pos = SEGLEN-1; // start at end
drops[j].vel = 0; // speed drops[j].vel = 0; // speed
@ -3059,7 +3059,7 @@ uint16_t WS2812FX::mode_drip(void)
setPixelColor(SEGLEN-1,color_blend(BLACK,SEGCOLOR(0), sourcedrop));// water source setPixelColor(SEGLEN-1,color_blend(BLACK,SEGCOLOR(0), sourcedrop));// water source
if (drops[j].colIndex==1) { if (drops[j].colIndex==1) {
if (drops[j].col>255) drops[j].col=255; if (drops[j].col>255) drops[j].col=255;
setPixelColor(int(drops[j].pos),color_blend(BLACK,SEGCOLOR(0),drops[j].col)); setPixelColor(uint16_t(drops[j].pos),color_blend(BLACK,SEGCOLOR(0),drops[j].col));
drops[j].col += map(SEGMENT.speed, 0, 255, 1, 6); // swelling drops[j].col += map(SEGMENT.speed, 0, 255, 1, 6); // swelling
@ -3072,10 +3072,10 @@ uint16_t WS2812FX::mode_drip(void)
if (drops[j].pos > 0) { // fall until end of segment if (drops[j].pos > 0) { // fall until end of segment
drops[j].pos += drops[j].vel; drops[j].pos += drops[j].vel;
if (drops[j].pos < 0) drops[j].pos = 0; if (drops[j].pos < 0) drops[j].pos = 0;
drops[j].vel += gravity; drops[j].vel += gravity; // gravity is negative
for (int i=1;i<7-drops[j].colIndex;i++) { // some minor math so we don't expand bouncing droplets for (uint8_t i=1;i<7-drops[j].colIndex;i++) { // some minor math so we don't expand bouncing droplets
setPixelColor(int(drops[j].pos)+i,color_blend(BLACK,SEGCOLOR(0),drops[j].col/i)); //spread pixel with fade while falling setPixelColor(MIN(uint16_t(drops[j].pos)+i,SEGLEN-1),color_blend(BLACK,SEGCOLOR(0),drops[j].col/i)); //spread pixel with fade while falling
} }
if (drops[j].colIndex > 2) { // during bounce, some water is on the floor if (drops[j].colIndex > 2) { // during bounce, some water is on the floor

View File

@ -206,12 +206,12 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
uint16_t realIndex = realPixelIndex(i); uint16_t realIndex = realPixelIndex(i);
for (uint16_t j = 0; j < SEGMENT.grouping; j++) { for (uint16_t j = 0; j < SEGMENT.grouping; j++) {
int16_t indexSet = realIndex + (IS_REVERSE ? -j : j); uint16_t indexSet = realIndex + (IS_REVERSE ? -j : j);
if (indexSet >= SEGMENT.start && indexSet < SEGMENT.stop) { // watch for group out of bounds condition if (indexSet >= SEGMENT.start && indexSet < SEGMENT.stop) { // watch for group out of bounds condition
if (IS_MIRROR) { //set the corresponding mirrored pixel if (IS_MIRROR) { //set the corresponding mirrored pixel
int16_t indexSetRev = SEGMENT.stop + SEGMENT.start - indexSet - 1; uint16_t indexMir = SEGMENT.stop + SEGMENT.start - indexSet - 1;
if (indexSetRev < customMappingSize) indexSetRev = customMappingTable[indexSetRev]; if (indexMir < customMappingSize) indexMir = customMappingTable[indexMir];
busses.setPixelColor(indexSetRev, col); busses.setPixelColor(indexMir, col);
} }
if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet]; if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet];
busses.setPixelColor(indexSet, col); busses.setPixelColor(indexSet, col);

View File

@ -2,6 +2,11 @@
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
#endif
/* /*
* Main WLED class implementation. Mostly initialization and connection logic * Main WLED class implementation. Mostly initialization and connection logic
*/ */
@ -290,6 +295,10 @@ void WLED::loop()
void WLED::setup() void WLED::setup()
{ {
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detection
#endif
Serial.begin(115200); Serial.begin(115200);
Serial.setTimeout(50); Serial.setTimeout(50);
DEBUG_PRINTLN(); DEBUG_PRINTLN();
@ -337,7 +346,7 @@ void WLED::setup()
DEBUG_PRINTLN(F("Reading config")); DEBUG_PRINTLN(F("Reading config"));
deserializeConfig(); deserializeConfig();
/*
#if STATUSLED #if STATUSLED
bool lStatusLed = false; bool lStatusLed = false;
for (uint8_t i=0; i<strip.numStrips; i++) { for (uint8_t i=0; i<strip.numStrips; i++) {
@ -346,12 +355,9 @@ void WLED::setup()
break; break;
} }
} }
if (!lStatusLed) if (!lStatusLed) pinMode(STATUSLED, OUTPUT);
pinMode(STATUSLED, OUTPUT);
#endif #endif
*/
//DEBUG_PRINTLN(F("Load EEPROM"));
//loadSettingsFromEEPROM();
DEBUG_PRINTLN(F("Initializing strip")); DEBUG_PRINTLN(F("Initializing strip"));
beginStrip(); beginStrip();
@ -681,6 +687,7 @@ void WLED::handleConnection()
void WLED::handleStatusLED() void WLED::handleStatusLED()
{ {
/*
#if STATUSLED #if STATUSLED
for (uint8_t s=0; s<strip.numStrips; s++) { for (uint8_t s=0; s<strip.numStrips; s++) {
if (strip.getStripPin(s)==STATUSLED) { if (strip.getStripPin(s)==STATUSLED) {
@ -706,4 +713,5 @@ void WLED::handleStatusLED()
} }
#endif #endif
*/
} }

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2104042 #define VERSION 2104061
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG
@ -47,6 +47,10 @@
// filesystem specific debugging // filesystem specific debugging
//#define WLED_DEBUG_FS //#define WLED_DEBUG_FS
//optionally disable brownout detector on ESP32.
//This is generally a terrible idea, but improves boot success on boards with a 3.3v regulator + cap setup that can't provide 400mA peaks
//#define WLED_DISABLE_BROWNOUT_DET
// Library inclusions. // Library inclusions.
#include <Arduino.h> #include <Arduino.h>
#ifdef ESP8266 #ifdef ESP8266