Merge branch 'dev' into audioreactive-prototype

This commit is contained in:
Blaz Kristan 2022-08-22 17:01:51 +02:00
commit cf46564c67
7 changed files with 1883 additions and 1861 deletions

View File

@ -501,7 +501,7 @@ typedef struct Segment {
inline bool getOption(uint8_t n) const { return ((options >> n) & 0x01); }
inline bool isSelected(void) const { return selected; }
inline bool isActive(void) const { return stop > start; }
inline bool is2D(void) const { return !(startY == 0 && stopY == 1); }
inline bool is2D(void) const { return (width()>1 && height()>1); }
inline uint16_t width(void) const { return stop - start; } // segment width in physical pixels (length if 1D)
inline uint16_t height(void) const { return stopY - startY; } // segment height (if 2D) in physical pixels
inline uint16_t length(void) const { return width() * height(); } // segment length (count) in physical pixels

View File

@ -150,6 +150,7 @@ uint16_t IRAM_ATTR Segment::XY(uint16_t x, uint16_t y) {
void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col)
{
if (!strip.isMatrix) return; // not a matrix set-up
if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0) return; // if pixel would fall out of virtual segment just exit
if (leds) leds[XY(x,y)] = col;

View File

@ -442,12 +442,17 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
break;
case M12_Circle:
// expand in circular fashion from center
for (float degrees = 0.0f; degrees <= 90.0f; degrees += 89.99f / (sqrtf((float)max(vH,vW))*i+1)) { // this may prove too many iterations on larger matrices
if (i==0)
setPixelColorXY(0, 0, col);
else {
float step = HALF_PI / (2*i);
for (float rad = 0.0f; rad <= HALF_PI+step/2; rad += step) {
// may want to try float version as well (with or without antialiasing)
int x = roundf(sin_t(degrees*DEG_TO_RAD) * i);
int y = roundf(cos_t(degrees*DEG_TO_RAD) * i);
int x = roundf(sin_t(rad) * i);
int y = roundf(cos_t(rad) * i);
setPixelColorXY(x, y, col);
}
}
break;
case M12_Block:
for (int x = 0; x <= i; x++) setPixelColorXY(x, i, col);
@ -455,9 +460,16 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
break;
}
return;
} else if (width()==1 && height()>1) {
// we have a vertical 1D segment
setPixelColorXY(0, i, col); // transpose
} else if (width()>1 && height()==1) {
// we have a horizontal 1D segment
setPixelColorXY(i, 0, col);
}
#endif
if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit
if (leds) leds[i] = col;
uint16_t len = length();

View File

@ -701,6 +701,10 @@ function populateSegments(s)
<div class="sliderdisplay"></div>
</div>
</div>`;
let staX = inst.start;
let stoX = inst.stop;
let staY = inst.startY;
let stoY = inst.stopY;
let rvXck = `<label class="check revchkl">Reverse ${isM?'':'direction'}<input type="checkbox" id="seg${i}rev" onchange="setRev(${i})" ${inst.rev?"checked":""}><span class="checkmark"></span></label>`;
let miXck = `<label class="check revchkl">Mirror<input type="checkbox" id="seg${i}mi" onchange="setMi(${i})" ${inst.mi?"checked":""}><span class="checkmark"></span></label>`;
let rvYck = "", miYck ="";
@ -745,14 +749,14 @@ function populateSegments(s)
<td>${isM?'':'Offset'}</td>
</tr>
<tr>
<td><input class="noslide segn" id="seg${i}s" type="number" min="0" max="${(isM?mw:ledCount)-1}" value="${inst.start}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td>
<td><input class="noslide segn" id="seg${i}e" type="number" min="0" max="${(isM?mw:ledCount)-(cfg.comp.seglen?inst.start:0)}" value="${inst.stop-(cfg.comp.seglen?inst.start:0)}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td>
<td><input class="noslide segn" id="seg${i}s" type="number" min="0" max="${(isM?mw:ledCount)-1}" value="${staX}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td>
<td><input class="noslide segn" id="seg${i}e" type="number" min="0" max="${(isM?mw:ledCount)-(cfg.comp.seglen?staX:0)}" value="${stoX-(cfg.comp.seglen?staX:0)}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td>
<td style="text-align:revert;">${isM?miXck+'<br>'+rvXck:''}<input class="noslide segn ${isM?'hide':''}" id="seg${i}of" type="number" value="${inst.of}" oninput="updateLen(${i})"></td>
</tr>
${isM ? '<tr><td>Start Y</td><td>'+(cfg.comp.seglen?'Height':'Stop Y')+'</td><td></td></tr>'+
'<tr>'+
'<td><input class="noslide segn" id="seg'+i+'sY" type="number" min="0" max="'+(mh-1)+'" value="'+inst.startY+'" oninput="updateLen('+i+')" onkeydown="segEnter('+i+')"></td>'+
'<td><input class="noslide segn" id="seg'+i+'eY" type="number" min="0" max="'+(mh-(cfg.comp.seglen?inst.startY:0))+'" value="'+(inst.stopY-(cfg.comp.seglen?inst.startY:0))+'" oninput="updateLen('+i+')" onkeydown="segEnter('+i+')"></td>'+
'<td><input class="noslide segn" id="seg'+i+'sY" type="number" min="0" max="'+(mh-1)+'" value="'+staY+'" oninput="updateLen('+i+')" onkeydown="segEnter('+i+')"></td>'+
'<td><input class="noslide segn" id="seg'+i+'eY" type="number" min="0" max="'+(mh-(cfg.comp.seglen?staY:0))+'" value="'+(stoY-(cfg.comp.seglen?staY:0))+'" oninput="updateLen('+i+')" onkeydown="segEnter('+i+')"></td>'+
'<td style="text-align:revert;">'+miYck+'<br>'+rvYck+'</td>'+
'</tr>':''}
<tr>
@ -768,7 +772,7 @@ function populateSegments(s)
</table>
<div class="h bp" id="seg${i}len"></div>
${!isM?rvXck:''}
${isM?map2D:''}
${isM&&stoY-staY>1&&stoX-staX>1?map2D:''}
${s.AudioReactive && s.AudioReactive.on ? "" : sndSim}
<label class="check revchkl">
${isM?'Transpose':'Mirror effect'}
@ -1031,14 +1035,16 @@ function updateLen(s)
var stop = parseInt(gId(`seg${s}e`).value);
var len = stop - (cfg.comp.seglen?0:start);
if (isM) {
start = parseInt(gId(`seg${s}sY`).value);
stop = parseInt(gId(`seg${s}eY`).value);
len *= (stop-(cfg.comp.seglen?0:start));
let startY = parseInt(gId(`seg${s}sY`).value);
let stopY = parseInt(gId(`seg${s}eY`).value);
len *= (stopY-(cfg.comp.seglen?0:startY));
if (stop-start>1 && stopY-startY>1) {
let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`);
if (sE) {
let sN = sE.querySelector(".lstIname").innerText;
let seg = gId(`seg${s}map2D`);
if (stop-start>1 && sN.indexOf("\u25A6")<0) seg.classList.remove("hide"); else seg.classList.add("hide");
if (seg && sN.indexOf("\u25A6")<0) seg.classList.remove("hide"); else seg.classList.add("hide");
}
}
}
var out = "(delete)";

File diff suppressed because it is too large Load Diff

View File

@ -219,6 +219,7 @@ void WLED::loop()
#if WLED_WATCHDOG_TIMEOUT > 0
// we finished our mainloop, reset the watchdog timer
if (!strip.isUpdating())
#ifdef ARDUINO_ARCH_ESP32
esp_task_wdt_reset();
#else
@ -280,8 +281,6 @@ void WLED::setup()
DEBUG_PRINT(F("heap "));
DEBUG_PRINTLN(ESP.getFreeHeap());
enableWatchdog();
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
if (psramFound()) {
// GPIO16/GPIO17 reserved for SPI RAM
@ -406,6 +405,8 @@ void WLED::setup()
// HTTP server page init
initServer();
enableWatchdog();
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); //enable brownout detector
#endif

View File

@ -3,12 +3,12 @@
/*
Main sketch, global variable declarations
@title WLED project sketch
@version 0.13.2-bl0
@version 0.14.0-b0
@author Christian Schwinne
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2208211
#define VERSION 2208222
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG