Compare commits
2 Commits
69d8da7f2a
...
4eb2ed52d2
Author | SHA1 | Date |
---|---|---|
Sylvain Munaut | 4eb2ed52d2 | |
Sylvain Munaut | 2277549293 |
|
@ -174,6 +174,7 @@ static const struct led_anim la_sparkle2 = {
|
|||
|
||||
struct la_candle_state {
|
||||
struct candle_state cdl[N_LEDS];
|
||||
uint8_t brg[N_LEDS];
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -181,8 +182,10 @@ la_candle_init(void *state)
|
|||
{
|
||||
struct la_candle_state *s = state;
|
||||
|
||||
for (int i=0; i<N_LEDS; i++)
|
||||
for (int i=0; i<N_LEDS; i++) {
|
||||
candle_init(&s->cdl[i]);
|
||||
s->brg[i] = 128 + (rand16() & 127);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -192,7 +195,7 @@ la_candle_render(void *state, uint16_t *leds,
|
|||
struct la_candle_state *s = state;
|
||||
|
||||
for (int i=0; i<N_LEDS; i++)
|
||||
leds[i] = (3750 * conf->dim * candle_exec(&s->cdl[i], conf->speed)) >> 8;
|
||||
leds[i] = (3750UL * s->brg[i] * conf->dim * candle_exec(&s->cdl[i], conf->speed)) >> 16;
|
||||
}
|
||||
|
||||
static const struct led_anim la_candle = {
|
||||
|
@ -277,9 +280,9 @@ la_breathe_render(void *state, uint16_t *leds,
|
|||
s->leds[i].pha = pha;
|
||||
|
||||
/* Early OverBright release */
|
||||
/* After pha >= 40000, we're not overbright anyway, so
|
||||
* allow another led to use it early */
|
||||
if (s->leds[i].ob && (s->leds[i].pha > 40000)) {
|
||||
/* After pha >= 28000, we know that it's safe to allow a new overbright led
|
||||
* because we'll be past the peak by the time they start needing overbright */
|
||||
if (s->leds[i].ob && (s->leds[i].pha > 28000)) {
|
||||
s->leds[i].ob = false;
|
||||
s->n_ob--;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue