Fixed ESP32 crash on Drip effect with reversed segment (#1854)
This commit is contained in:
parent
46d66dded8
commit
ecdc0a3800
@ -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)
|
||||||
|
|
||||||
### WLED release 0.12.0
|
### WLED release 0.12.0
|
||||||
|
|
||||||
#### Build 2104020
|
#### Build 2104020
|
||||||
|
@ -3081,7 +3081,7 @@ uint16_t WS2812FX::mode_drip(void)
|
|||||||
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
|
||||||
@ -3092,7 +3092,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
|
||||||
|
|
||||||
@ -3107,8 +3107,9 @@ uint16_t WS2812FX::mode_drip(void)
|
|||||||
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;
|
||||||
|
|
||||||
for (int i=1;i<7-drops[j].colIndex;i++) { // some minor math so we don't expand bouncing droplets
|
for (uint16_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
|
uint16_t pos = uint16_t(drops[j].pos) +i; //this is BAD, returns a pos >= SEGLEN occasionally
|
||||||
|
setPixelColor(pos,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
|
||||||
|
@ -191,7 +191,7 @@ 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 + (reversed ? -j : j);
|
int indexSet = realIndex + (reversed ? -j : j);
|
||||||
if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet];
|
if (indexSet < customMappingSize) indexSet = customMappingTable[indexSet];
|
||||||
if (indexSet >= SEGMENT.start && indexSet < SEGMENT.stop) {
|
if (indexSet >= SEGMENT.start && indexSet < SEGMENT.stop) {
|
||||||
busses.setPixelColor(indexSet + skip, col);
|
busses.setPixelColor(indexSet + skip, col);
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
@ -285,6 +290,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,8 +346,6 @@ void WLED::setup()
|
|||||||
pinMode(STATUSLED, OUTPUT);
|
pinMode(STATUSLED, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//DEBUG_PRINTLN(F("Load EEPROM"));
|
|
||||||
//loadSettingsFromEEPROM();
|
|
||||||
beginStrip();
|
beginStrip();
|
||||||
userSetup();
|
userSetup();
|
||||||
usermods.setup();
|
usermods.setup();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2104020
|
#define VERSION 2104030
|
||||||
|
|
||||||
//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
|
||||||
|
Loading…
Reference in New Issue
Block a user