fix: chase steps of 0 hold still; remove the marquee style
Step A and step B (n3, n4) of 0 stop the dot instead of moving 1. The chase defaults set them to 1 explicitly. The marquee style (n6 = 1) and its built-in "Chase Marquee" preset are removed: a chase with colour 2 set to black gives the same gaps. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
24dd5ffb15
commit
12a8e225ad
4 files changed
+12
-46
No files matched your search
+5
-30
@@ -260,34 +260,8 @@ bool fx_chase(fx_t &f, st_t &s)
|
||||
{
|
||||
int b = f.pr->brightness;
|
||||
int nled = f.n;
|
||||
if (f.pr->n[6] == 1) {
|
||||
// Marquee: dashes that scroll
|
||||
const rgb def[1] = { WHITE };
|
||||
rgb c[PATTERN_MAX_COLOURS];
|
||||
int nc = get_colours(f, def, 1, c);
|
||||
(void)nc;
|
||||
int on_len = nz(f.pr->n[1], 3);
|
||||
int off_len = nz(f.pr->n[2], 2);
|
||||
int step = f.pr->n[3] == 0 ? 1 : f.pr->n[3]; // negative steps walk the other way
|
||||
int period = on_len + off_len;
|
||||
if (first_call(s)) {
|
||||
s.last = f.now;
|
||||
}
|
||||
uint32_t d = f.pr->delay < 1 ? 1 : f.pr->delay;
|
||||
if (!due(f.now, s.last, d)) {
|
||||
return false;
|
||||
}
|
||||
rgb col = ab(c[0], b);
|
||||
rgb bgc = ab(mk(f.pr->bg[0], f.pr->bg[1], f.pr->bg[2]), b);
|
||||
for (int i = 0; i < nled; i++) {
|
||||
int m = pmod(i + s.phase, period);
|
||||
putl(f, i, m < on_len ? col : bgc);
|
||||
}
|
||||
s.phase = pmod(s.phase + step, period);
|
||||
return !f.pr->autorun;
|
||||
}
|
||||
|
||||
// Chase: two colours moving along the strip, n1/n2 segment lengths, n3/n4 steps
|
||||
// Chase: two colours moving along the strip, n1/n2 segment lengths, n3/n4 steps (0 holds still)
|
||||
const rgb def[2] = { WHITE, WHITE };
|
||||
rgb c[PATTERN_MAX_COLOURS];
|
||||
int nc = get_colours(f, def, 2, c);
|
||||
@@ -295,9 +269,10 @@ bool fx_chase(fx_t &f, st_t &s)
|
||||
rgb color1 = ab(nc > 1 ? c[1] : c[0], b);
|
||||
int n1 = nz(f.pr->n[1], 1);
|
||||
int n2 = nz(f.pr->n[2], 1);
|
||||
// Steps may be negative: a negative n3/n4 walks the dot the other way. 0 (unset) means 1.
|
||||
int n3 = f.pr->n[3] == 0 ? 1 : f.pr->n[3];
|
||||
int n4 = f.pr->n[4] == 0 ? 1 : f.pr->n[4];
|
||||
// Steps may be negative: a negative n3/n4 walks the dot the other way. 0 stops the dot on those steps, so
|
||||
// both are used as they are; the defaults set them to 1 (preset_defaults).
|
||||
int n3 = f.pr->n[3];
|
||||
int n4 = f.pr->n[4];
|
||||
int seg = n1 + n2;
|
||||
int max_pos = nled + seg;
|
||||
auto position = [&](int sc) {
|
||||
|
||||
@@ -141,6 +141,9 @@ void preset_defaults(preset_t *p, int pattern)
|
||||
p->reverse = false;
|
||||
p->fade = 0;
|
||||
p->beat_time = false;
|
||||
if (pattern == patterns_index("chase")) {
|
||||
p->n[1] = p->n[2] = p->n[3] = p->n[4] = 1; // step B 0 stops the dot, so the default is explicit
|
||||
}
|
||||
}
|
||||
|
||||
// Keep a preset within the ranges the patterns expect
|
||||
|
||||
@@ -234,13 +234,6 @@ static int build_defaults(preset_t *out, int max)
|
||||
p->delay = 150;
|
||||
p->brightness = 180;
|
||||
}
|
||||
if ((p = add("Chase Marquee", "chase"))) {
|
||||
p->ncol = 1;
|
||||
p->col[0][0] = 255; p->col[0][1] = 200; p->col[0][2] = 80;
|
||||
p->n[1] = 3; p->n[2] = 2; p->n[3] = 1; p->n[6] = 1; // dashes that scroll
|
||||
p->delay = 120;
|
||||
p->brightness = 180;
|
||||
}
|
||||
if ((p = add("Chase Reverse", "chase"))) {
|
||||
p->ncol = 2;
|
||||
p->col[0][0] = 0; p->col[0][1] = 255; p->col[0][2] = 120;
|
||||
|
||||
Reference in new issue
Block a user