program 2 works in preview mode

This commit is contained in:
true 2024-08-05 20:00:26 -07:00
parent 196a2b8301
commit 184c466c3b
1 changed files with 47 additions and 15 deletions

View File

@ -281,11 +281,20 @@ void led_rgb_2_twinkle(uint8_t preview, uint8_t tick)
uint32_t rnd;
uint8_t sat;
uint8_t show;
// set
if ((tick & 3) == 0) {
rnd = prng_get8();
if (preview && (preview & 0xf) != 2) {
// possibly increase chances to flash for top icon
rnd >>= 2;
}
if (rnd < userconf.ledprog_setting[2][1]) {
// yup, we're doing it
show = 1;
rnd = prng_get16();
rnd *= 1536;
rnd >>= 16;
@ -299,23 +308,46 @@ void led_rgb_2_twinkle(uint8_t preview, uint8_t tick)
rnd = prng_get16() & 0xfff;
rnd /= 455;
rgb[rnd][0] = prog_rgb[0];
rgb[rnd][1] = prog_rgb[1];
rgb[rnd][2] = prog_rgb[2];
twinkle_set[rnd] = TWINKLE_PERSIST;
if (preview) {
show = 0;
if (rnd == 2) show = 1;
else if (((preview & 0xf) == 2) && (rnd >= 5)) {
show = 1;
}
}
if (show) {
rgb[rnd][0] = prog_rgb[0];
rgb[rnd][1] = prog_rgb[1];
rgb[rnd][2] = prog_rgb[2];
twinkle_set[rnd] = TWINKLE_PERSIST;
}
}
for (i = 0; i < 9; i++) {
show = 1;
// kinda bad but no fucking time to finish this code
if (preview) {
show = 0;
if (i == 2) show = 1;
else if (((preview & 0xf) == 2) && (i >= 5)) {
show = 1;
}
}
if (show) {
if (twinkle_set[i]) twinkle_set[i]--;
for (j = 0; j < 3; j++) {
if (twinkle_set[i]) rgb[i][j]--;
else rgb[i][j] >>= 1;
}
}
led_is_updated();
}
}
// decay
for (i = 0; i < 9; i++) {
twinkle_set[i]--;
for (j = 0; j < 2; j++) {
if (twinkle_set[i]) rgb[i][j]--;
else rgb[i][j] >>= 1;
}
}
led_is_updated();
}
/*