From fb6dfcd3fceb9f03688d8448535390a009243e1d Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Mon, 22 Aug 2022 16:47:25 +0200 Subject: [PATCH] Index under- shooting. Fix for arc 1D to 2D mapping. UI segment 2D mapping fix. Watchdog reposition & flicker reduction. --- wled00/FX_2Dfcn.cpp | 2 +- wled00/FX_fcn.cpp | 6 +- wled00/data/index.js | 32 +- wled00/html_ui.h | 3532 +++++++++++++++++++++--------------------- wled00/wled.cpp | 5 +- 5 files changed, 1792 insertions(+), 1785 deletions(-) diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index a9989476..e567e49f 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -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; diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index dd621d71..4edf05c1 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -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(); diff --git a/wled00/data/index.js b/wled00/data/index.js index 077d1534..badaf9c2 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -701,6 +701,10 @@ function populateSegments(s)
`; + let staX = inst.start; + let stoX = inst.stop; + let staY = inst.startY; + let stoY = inst.stopY; let rvXck = ``; let miXck = ``; let rvYck = "", miYck =""; @@ -745,14 +749,14 @@ function populateSegments(s) ${isM?'':'Offset'} - - + + ${isM?miXck+'
'+rvXck:''} ${isM ? 'Start Y'+(cfg.comp.seglen?'Height':'Stop Y')+''+ ''+ - ''+ - ''+ + ''+ + ''+ ''+miYck+'
'+rvYck+''+ '':''} @@ -768,7 +772,7 @@ function populateSegments(s)
${!isM?rvXck:''} - ${isM?map2D:''} + ${isM&&stoY-staY>1&&stoX-staX>1?map2D:''} ${s.AudioReactive && s.AudioReactive.on ? "" : sndSim}