Skip to content

Commit 2c8dbb9

Browse files
committed
Tetix & FX option bugfix.
- mono color with palette option
1 parent 3da2ec5 commit 2c8dbb9

File tree

4 files changed

+1238
-1229
lines changed

4 files changed

+1238
-1229
lines changed

wled00/FX.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,7 @@ uint16_t mode_tetrix(void) {
34833483
if (SEGENV.call == 0) {
34843484
drop->stack = 0; // reset brick stack size
34853485
drop->step = 0;
3486+
if (SEGMENT.check1) drop->col = 0;// use only one color from palette
34863487
//for (int i=0; i<SEGLEN; i++) SEGMENT.setPixelColor(indexToVStrip(i, stripNr), SEGCOLOR(1)); // will fill virtual strip only
34873488
}
34883489

@@ -3494,7 +3495,7 @@ uint16_t mode_tetrix(void) {
34943495
speed = map(speed, 1, 255, 5000, 250); // time taken for full (SEGLEN) drop
34953496
drop->speed = float(SEGLEN * FRAMETIME) / float(speed); // set speed
34963497
drop->pos = SEGLEN; // start at end of segment (no need to subtract 1)
3497-
drop->col = random8(0,15)<<4; // limit color choices so there is enough HUE gap
3498+
if (!SEGMENT.check1) drop->col = random8(0,15)<<4; // limit color choices so there is enough HUE gap
34983499
drop->step = 1; // drop state (0 init, 1 forming, 2 falling)
34993500
drop->brick = (SEGMENT.intensity ? (SEGMENT.intensity>>5)+1 : random8(1,5)) * (1+(SEGLEN>>6)); // size of brick
35003501
}
@@ -3508,7 +3509,7 @@ uint16_t mode_tetrix(void) {
35083509
if (drop->step == 2) { // falling
35093510
if (drop->pos > drop->stack) { // fall until top of stack
35103511
drop->pos -= drop->speed; // may add gravity as: speed += gravity
3511-
if (uint16_t(drop->pos) < drop->stack) drop->pos = drop->stack;
3512+
if (int(drop->pos) < int(drop->stack)) drop->pos = drop->stack;
35123513
for (int i=int(drop->pos); i<SEGLEN; i++) {
35133514
uint32_t col = i<int(drop->pos)+drop->brick ? SEGMENT.color_from_palette(drop->col, false, false, 0) : SEGCOLOR(1);
35143515
SEGMENT.setPixelColor(indexToVStrip(i, stripNr), col);
@@ -3528,6 +3529,7 @@ uint16_t mode_tetrix(void) {
35283529
} else {
35293530
drop->stack = 0; // reset brick stack size
35303531
drop->step = 0; // proceed with next brick
3532+
if (SEGMENT.check1) drop->col += 8; // gradually increase palette index
35313533
}
35323534
}
35333535
}
@@ -3538,7 +3540,7 @@ uint16_t mode_tetrix(void) {
35383540

35393541
return FRAMETIME;
35403542
}
3541-
static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width;!,!;!;;sx=0,ix=0,pal=11,m12=1";
3543+
static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width,,,,One color;!,!;!;;sx=0,ix=0,pal=11,m12=1";
35423544

35433545

35443546
/*

wled00/data/index.htm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@
286286
</div>
287287
<div id="fxopt" class="option fade">
288288
<label id="opt0" class="check ochkl hide"><i class="icons">&#xe2b3;</i><span class="tooltiptext" id="optLabel0">Check 1</span>
289-
<input type="checkbox" onchange="setOption(1, this.checked)">
289+
<input id="checkO1" type="checkbox" onchange="setOption(1, this.checked)">
290290
<span class="checkmark"></span>
291291
</label>
292292
<label id="opt1" class="check ochkl hide"><i class="icons">&#xe34b;</i><span class="tooltiptext" id="optLabel1">Check 2</span>
293-
<input type="checkbox" onchange="setOption(2, this.checked)">
293+
<input id="checkO2" type="checkbox" onchange="setOption(2, this.checked)">
294294
<span class="checkmark"></span>
295295
</label>
296296
<label id="opt2" class="check ochkl hide"><i class="icons">&#xe04c;</i><span class="tooltiptext" id="optLabel2">Check 3</span>
297-
<input type="checkbox" onchange="setOption(3, this.checked)">
297+
<input id="checkO3" type="checkbox" onchange="setOption(3, this.checked)">
298298
<span class="checkmark"></span>
299299
</label>
300300
</div>

wled00/data/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,9 @@ function readState(s,command=false)
13241324
gId('sliderC1').value = i.c1 ? i.c1 : 0;
13251325
gId('sliderC2').value = i.c2 ? i.c2 : 0;
13261326
gId('sliderC3').value = i.c3 ? i.c3 : 0;
1327+
gId('checkO1').checked = !(!i.o1);
1328+
gId('checkO2').checked = !(!i.o2);
1329+
gId('checkO3').checked = !(!i.o3);
13271330

13281331
if (s.error && s.error != 0) {
13291332
var errstr = "";

0 commit comments

Comments
 (0)