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
### 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
- 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)
{
//allocate segment data
uint16_t numDrops = 4;
uint8_t numDrops = 4;
uint16_t dataSize = sizeof(spark) * numDrops;
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);
numDrops = 1 + (SEGMENT.intensity >> 6);
numDrops = 1 + (SEGMENT.intensity >> 6); // 255>>6 = 3
float gravity = -0.001 - (SEGMENT.speed/50000.0);
gravity *= SEGLEN;
int sourcedrop = 12;
for (int j=0;j<numDrops;j++) {
for (uint8_t j=0;j<numDrops;j++) {
if (drops[j].colIndex == 0) { //init
drops[j].pos = SEGLEN-1; // start at end
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
if (drops[j].colIndex==1) {
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
@ -3072,10 +3072,10 @@ uint16_t WS2812FX::mode_drip(void)
if (drops[j].pos > 0) { // fall until end of segment
drops[j].pos += drops[j].vel;
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
setPixelColor(int(drops[j].pos)+i,color_blend(BLACK,SEGCOLOR(0),drops[j].col/i)); //spread pixel with fade while falling
for (uint8_t i=1;i<7-drops[j].colIndex;i++) { // some minor math so we don't expand bouncing droplets
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

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);
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 (IS_MIRROR) { //set the corresponding mirrored pixel
int16_t indexSetRev = SEGMENT.stop + SEGMENT.start - indexSet - 1;
if (indexSetRev < customMappingSize) indexSetRev = customMappingTable[indexSetRev];
busses.setPixelColor(indexSetRev, col);
uint16_t indexMir = SEGMENT.stop + SEGMENT.start - indexSet - 1;
if (indexMir < customMappingSize) indexMir = customMappingTable[indexMir];
busses.setPixelColor(indexMir, col);
}
if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet];
busses.setPixelColor(indexSet, col);

View File

@ -2,6 +2,11 @@
#include "wled.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
*/
@ -290,6 +295,10 @@ void WLED::loop()
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.setTimeout(50);
DEBUG_PRINTLN();
@ -337,7 +346,7 @@ void WLED::setup()
DEBUG_PRINTLN(F("Reading config"));
deserializeConfig();
/*
#if STATUSLED
bool lStatusLed = false;
for (uint8_t i=0; i<strip.numStrips; i++) {
@ -346,12 +355,9 @@ void WLED::setup()
break;
}
}
if (!lStatusLed)
pinMode(STATUSLED, OUTPUT);
if (!lStatusLed) pinMode(STATUSLED, OUTPUT);
#endif
//DEBUG_PRINTLN(F("Load EEPROM"));
//loadSettingsFromEEPROM();
*/
DEBUG_PRINTLN(F("Initializing strip"));
beginStrip();
@ -681,6 +687,7 @@ void WLED::handleConnection()
void WLED::handleStatusLED()
{
/*
#if STATUSLED
for (uint8_t s=0; s<strip.numStrips; s++) {
if (strip.getStripPin(s)==STATUSLED) {
@ -706,4 +713,5 @@ void WLED::handleStatusLED()
}
#endif
*/
}

View File

@ -8,7 +8,7 @@
*/
// 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
//#define WLED_USE_MY_CONFIG
@ -47,6 +47,10 @@
// filesystem specific debugging
//#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.
#include <Arduino.h>
#ifdef ESP8266