Index under- shooting.

Fix for arc 1D to 2D mapping.
UI segment 2D mapping fix.
Watchdog reposition & flicker reduction.
This commit is contained in:
Blaz Kristan 2022-08-22 16:47:25 +02:00
parent e14c5bbd25
commit fb6dfcd3fc
5 changed files with 1792 additions and 1785 deletions

View File

@ -150,7 +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()) return; // if pixel would fall out of virtual segment just exit
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

@ -445,8 +445,8 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
if (i==0)
setPixelColorXY(0, 0, col);
else {
float step = HALF_PI / (2*i+1); // sqrtf((float)max(vH,vW))*i+1
for (float rad = 0.0f; rad <= HALF_PI; rad += step) {
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(rad) * i);
int y = roundf(cos_t(rad) * i);
@ -469,7 +469,7 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
}
#endif
if (i >= virtualLength()) return; // if pixel would fall out of segment just exit
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