Merge branch 'main' into fx-upd

This commit is contained in:
Blaz Kristan 2023-01-24 16:39:49 +01:00
commit 07cc26a144
8 changed files with 1775 additions and 1771 deletions

View File

@ -383,9 +383,9 @@ class UsermodTemperature : public Usermod {
void appendConfigData() void appendConfigData()
{ {
oappend(SET_F("addInfo('")); oappend(SET_F(FPSTR(_name))); oappend(SET_F(":")); oappend(SET_F(FPSTR(_parasite))); oappend(SET_F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F(":")); oappend(String(FPSTR(_parasite)).c_str());
oappend(SET_F("',1,'<i>(if no Vcc connected)</i>');")); // 0 is field type, 1 is actual field oappend(SET_F("',1,'<i>(if no Vcc connected)</i>');")); // 0 is field type, 1 is actual field
oappend(SET_F("addInfo('")); oappend(SET_F(FPSTR(_name))); oappend(SET_F(":")); oappend(SET_F(FPSTR(_parasitePin))); oappend(SET_F("addInfo('")); oappend(String(FPSTR(_name)).c_str()); oappend(SET_F(":")); oappend(String(FPSTR(_parasitePin)).c_str());
oappend(SET_F("',1,'<i>(for external MOSFET)</i>');")); // 0 is field type, 1 is actual field oappend(SET_F("',1,'<i>(for external MOSFET)</i>');")); // 0 is field type, 1 is actual field
} }

View File

@ -184,7 +184,7 @@ class MultiRelay : public Usermod {
*/ */
MultiRelay() { MultiRelay() {
const int8_t defPins[] = {MULTI_RELAY_PINS}; const int8_t defPins[] = {MULTI_RELAY_PINS};
for (int i=0; i<MULTI_RELAY_MAX_RELAYS; i++) { for (size_t i=0; i<MULTI_RELAY_MAX_RELAYS; i++) {
_relay[i].pin = i<sizeof(defPins) ? defPins[i] : -1; _relay[i].pin = i<sizeof(defPins) ? defPins[i] : -1;
_relay[i].delay = 0; _relay[i].delay = 0;
_relay[i].mode = false; _relay[i].mode = false;

View File

@ -4853,7 +4853,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https:
for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) prevLeds[XY(x,y)] = CRGB::Black; for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) prevLeds[XY(x,y)] = CRGB::Black;
memset(crcBuffer, 0, sizeof(uint16_t)*crcBufferLen); memset(crcBuffer, 0, sizeof(uint16_t)*crcBufferLen);
} else if (strip.now - SEGENV.step < FRAMETIME_FIXED * map(SEGMENT.speed,0,255,64,4)) { // warning: comparison between signed and unsigned integer expressions } else if (strip.now - SEGENV.step < FRAMETIME_FIXED * (uint32_t)map(SEGMENT.speed,0,255,64,4)) {
// update only when appropriate time passes (in 42 FPS slots) // update only when appropriate time passes (in 42 FPS slots)
return FRAMETIME; return FRAMETIME;
} }
@ -5876,10 +5876,8 @@ uint16_t mode_2Dscrollingtext(void) {
++SEGENV.aux1 &= 0xFF; // color shift ++SEGENV.aux1 &= 0xFF; // color shift
SEGENV.step = millis() + map(SEGMENT.speed, 0, 255, 10*FRAMETIME_FIXED, 2*FRAMETIME_FIXED); SEGENV.step = millis() + map(SEGMENT.speed, 0, 255, 10*FRAMETIME_FIXED, 2*FRAMETIME_FIXED);
if (!SEGMENT.check2) { if (!SEGMENT.check2) {
// we need it 3 times for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++ )
SEGMENT.fade_out(255 - (SEGMENT.custom1>>5)); // fade to background color SEGMENT.blendPixelColorXY(x, y, SEGCOLOR(1), 255 - (SEGMENT.custom1>>1));
SEGMENT.fade_out(255 - (SEGMENT.custom1>>5)); // fade to background color
SEGMENT.fade_out(255 - (SEGMENT.custom1>>5)); // fade to background color
} }
} }
for (int i = 0; i < numberOfLetters; i++) { for (int i = 0; i < numberOfLetters; i++) {

View File

@ -64,6 +64,7 @@ void WS2812FX::setUpMatrix() {
Segment::maxHeight = 1; Segment::maxHeight = 1;
panels = 0; panels = 0;
panel.clear(); // release memory allocated by panels panel.clear(); // release memory allocated by panels
resetSegments();
return; return;
} }
@ -107,8 +108,8 @@ void WS2812FX::setUpMatrix() {
panel.clear(); panel.clear();
Segment::maxWidth = _length; Segment::maxWidth = _length;
Segment::maxHeight = 1; Segment::maxHeight = 1;
return;
} }
resetSegments();
} }
#else #else
isMatrix = false; // no matter what config says isMatrix = false; // no matter what config says
@ -527,7 +528,7 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
for (int j = 0; j<w; j++) { // character width for (int j = 0; j<w; j++) { // character width
int16_t x0 = x + (w-1) - j; int16_t x0 = x + (w-1) - j;
if ((x0 >= 0 || x0 < cols) && ((bits>>(j+(8-w))) & 0x01)) { // bit set & drawing on-screen if ((x0 >= 0 || x0 < cols) && ((bits>>(j+(8-w))) & 0x01)) { // bit set & drawing on-screen
addPixelColorXY(x0, y0, col); setPixelColorXY(x0, y0, col);
} }
} }
} }

View File

@ -1189,7 +1189,7 @@ TD .checkmark, TD .radiomark {
} }
.bp { .bp {
margin-bottom: 5px; margin-bottom: 8px;
} }
/* segment & preset wrapper */ /* segment & preset wrapper */

View File

@ -772,7 +772,7 @@ function populateSegments(s)
<tr> <tr>
<td><input class="noslide segn" id="seg${i}grp" type="number" min="1" max="255" value="${inst.grp}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td> <td><input class="noslide segn" id="seg${i}grp" type="number" min="1" max="255" value="${inst.grp}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td>
<td><input class="noslide segn" id="seg${i}spc" type="number" min="0" max="255" value="${inst.spc}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td> <td><input class="noslide segn" id="seg${i}spc" type="number" min="0" max="255" value="${inst.spc}" oninput="updateLen(${i})" onkeydown="segEnter(${i})"></td>
<td><button class="btn btn-xs" onclick="setSeg(${i})"><i class="icons btn-icon" id="segc${i}">&#xe390;</i></button></td> <td style="text-align:left;"><button class="btn btn-xs" onclick="setSeg(${i})"><i class="icons btn-icon" id="segc${i}">&#xe390;</i></button></td>
</tr> </tr>
</table> </table>
<div class="h bp" id="seg${i}len"></div> <div class="h bp" id="seg${i}len"></div>
@ -1047,13 +1047,13 @@ function updateLen(s)
{ {
if (!gId(`seg${s}s`)) return; if (!gId(`seg${s}s`)) return;
var start = parseInt(gId(`seg${s}s`).value); var start = parseInt(gId(`seg${s}s`).value);
var stop = parseInt(gId(`seg${s}e`).value); var stop = parseInt(gId(`seg${s}e`).value) + (cfg.comp.seglen?start:0);
var len = stop - (cfg.comp.seglen?0:start); var len = stop - start;
if (isM) { if (isM) {
// matrix setup // matrix setup
let startY = parseInt(gId(`seg${s}sY`).value); let startY = parseInt(gId(`seg${s}sY`).value);
let stopY = parseInt(gId(`seg${s}eY`).value); let stopY = parseInt(gId(`seg${s}eY`).value) + (cfg.comp.seglen?startY:0);
len *= (stopY-(cfg.comp.seglen?0:startY)); len *= (stopY-startY);
let tPL = gId(`seg${s}lbtm`); let tPL = gId(`seg${s}lbtm`);
if (stop-start>1 && stopY-startY>1) { if (stop-start>1 && stopY-startY>1) {
// 2D segment // 2D segment
@ -1662,19 +1662,23 @@ function toggleNodes()
function makeSeg() function makeSeg()
{ {
var ns = 0; var ns = 0, ct = 0;
var lu = lowestUnused; var lu = lowestUnused;
let li = lastinfo; let li = lastinfo;
if (lu > 0) { if (lu > 0) {
var pend = parseInt(gId(`seg${lu -1}e`).value,10) + (cfg.comp.seglen?parseInt(gId(`seg${lu -1}s`).value,10):0); let xend = parseInt(gId(`seg${lu -1}e`).value,10) + (cfg.comp.seglen?parseInt(gId(`seg${lu -1}s`).value,10):0);
if (pend < ledCount) ns = pend; if (isM) {
ns = 0;
ct = mw;
} else {
if (xend < ledCount) ns = xend;
ct = ledCount-(cfg.comp.seglen?ns:0)
}
} }
gId('segutil').scrollIntoView({ gId('segutil').scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'start', block: 'start',
}); });
var ct = (isM?mw:ledCount)-(cfg.comp.seglen?ns:0);
//TODO: add calculation for Y in case of 2D matrix
var cn = `<div class="seg lstI expanded"> var cn = `<div class="seg lstI expanded">
<div class="segin"> <div class="segin">
<input type="text" class="noslide" id="seg${lu}t" autocomplete="off" maxlength=32 value="" placeholder="New segment ${lu}"/> <input type="text" class="noslide" id="seg${lu}t" autocomplete="off" maxlength=32 value="" placeholder="New segment ${lu}"/>

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2301170 #define VERSION 2301240
//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