Make the spooky and eerie animations more pronounced
This commit is contained in:
parent
196278a2fe
commit
a7af4accc0
|
@ -71,7 +71,7 @@ lantern_t lantern_new(sk9822_t lights) {
|
|||
sk9822_init(&lights);
|
||||
return (lantern_t){
|
||||
.lights = lights,
|
||||
.color_scheme = normal,
|
||||
.color_scheme = cse_off,
|
||||
.animations = {
|
||||
animation_new(),
|
||||
animation_new(),
|
||||
|
@ -86,6 +86,15 @@ lantern_t lantern_new(sk9822_t lights) {
|
|||
};
|
||||
}
|
||||
|
||||
void lantern_start_off(lantern_t *self, int light_idx) {
|
||||
animation_begin(
|
||||
&self->animations[light_idx],
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1);
|
||||
}
|
||||
|
||||
void lantern_start_normal(lantern_t *self, int light_idx) {
|
||||
switch (light_idx) {
|
||||
case 0:
|
||||
|
@ -157,19 +166,19 @@ void lantern_start_spooky(lantern_t *self, int light_idx) {
|
|||
animation_begin(
|
||||
&self->animations[0],
|
||||
0,
|
||||
random_step(self->animations[0].color.g, 80, 120),
|
||||
random_step(self->animations[0].color.g, 40, 140),
|
||||
0,
|
||||
5);
|
||||
animation_begin(
|
||||
&self->animations[3],
|
||||
0,
|
||||
random_step(self->animations[3].color.g, 80, 120),
|
||||
random_step(self->animations[3].color.g, 40, 140),
|
||||
0,
|
||||
5);
|
||||
animation_begin(
|
||||
&self->animations[6],
|
||||
0,
|
||||
random_step(self->animations[6].color.g, 80, 120),
|
||||
random_step(self->animations[6].color.g, 40, 140),
|
||||
0,
|
||||
5);
|
||||
break;
|
||||
|
@ -177,19 +186,19 @@ void lantern_start_spooky(lantern_t *self, int light_idx) {
|
|||
animation_begin(
|
||||
&self->animations[1],
|
||||
0,
|
||||
random_step(self->animations[1].color.g, 60, 100),
|
||||
random_step(self->animations[1].color.g, 20, 80),
|
||||
0,
|
||||
5);
|
||||
animation_begin(
|
||||
&self->animations[4],
|
||||
0,
|
||||
random_step(self->animations[4].color.g, 60, 100),
|
||||
random_step(self->animations[4].color.g, 20, 80),
|
||||
0,
|
||||
5);
|
||||
animation_begin(
|
||||
&self->animations[7],
|
||||
0,
|
||||
random_step(self->animations[7].color.g, 60, 100),
|
||||
random_step(self->animations[7].color.g, 20, 80),
|
||||
0,
|
||||
5);
|
||||
break;
|
||||
|
@ -197,19 +206,19 @@ void lantern_start_spooky(lantern_t *self, int light_idx) {
|
|||
animation_begin(
|
||||
&self->animations[2],
|
||||
0,
|
||||
random_step(self->animations[2].color.g, 20, 40),
|
||||
random_step(self->animations[2].color.g, 10, 40),
|
||||
0,
|
||||
5);
|
||||
animation_begin(
|
||||
&self->animations[5],
|
||||
0,
|
||||
random_step(self->animations[5].color.g, 20, 40),
|
||||
random_step(self->animations[5].color.g, 10, 40),
|
||||
0,
|
||||
5);
|
||||
animation_begin(
|
||||
&self->animations[8],
|
||||
0,
|
||||
random_step(self->animations[8].color.g, 20, 40),
|
||||
random_step(self->animations[8].color.g, 10, 40),
|
||||
0,
|
||||
5);
|
||||
break;
|
||||
|
@ -289,16 +298,19 @@ void lantern_step(lantern_t *self, rgb_t colors[LIGHT_COUNT]) {
|
|||
for (int i = 0; i < LIGHT_COUNT; i++) {
|
||||
if (!animation_running(&self->animations[i])) {
|
||||
switch (self->color_scheme) {
|
||||
case normal:
|
||||
case cse_off:
|
||||
lantern_start_off(self, i);
|
||||
break;
|
||||
case cse_normal:
|
||||
lantern_start_normal(self, i);
|
||||
break;
|
||||
case spooky:
|
||||
case cse_spooky:
|
||||
lantern_start_spooky(self, i);
|
||||
break;
|
||||
case eerie:
|
||||
case cse_eerie:
|
||||
lantern_start_eerie(self, i);
|
||||
break;
|
||||
case flash:
|
||||
case cse_flash:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,11 @@ typedef struct {
|
|||
} animation_t;
|
||||
|
||||
typedef enum {
|
||||
normal,
|
||||
spooky,
|
||||
eerie,
|
||||
flash
|
||||
cse_off,
|
||||
cse_normal,
|
||||
cse_spooky,
|
||||
cse_eerie,
|
||||
cse_flash
|
||||
} color_scheme_e;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -30,6 +30,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
#define PULSE_ON_COUNT 5
|
||||
|
||||
typedef enum {
|
||||
lme_off,
|
||||
lme_normal,
|
||||
lme_spooky,
|
||||
lme_eerie,
|
||||
|
@ -137,7 +138,7 @@ int main(void) {
|
|||
};
|
||||
|
||||
lantern_t lantern = lantern_new(lights);
|
||||
lantern_set_mode(&lantern, normal);
|
||||
lantern_set_mode(&lantern, cse_off);
|
||||
|
||||
// setup_fps_timer();
|
||||
|
||||
|
@ -177,14 +178,17 @@ int main(void) {
|
|||
rfm_receive(&radio, (uint8_t *)msg, &length);
|
||||
if (length == 1) {
|
||||
switch (msg[0]) {
|
||||
case lme_off:
|
||||
lantern_set_mode(&lantern, cse_off);
|
||||
break;
|
||||
case lme_normal:
|
||||
lantern_set_mode(&lantern, normal);
|
||||
lantern_set_mode(&lantern, cse_normal);
|
||||
break;
|
||||
case lme_spooky:
|
||||
lantern_set_mode(&lantern, spooky);
|
||||
lantern_set_mode(&lantern, cse_spooky);
|
||||
break;
|
||||
case lme_eerie:
|
||||
lantern_set_mode(&lantern, eerie);
|
||||
lantern_set_mode(&lantern, cse_eerie);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue