Fix the animation build
This commit is contained in:
parent
221dcd1541
commit
e03485b1e5
|
@ -25,6 +25,7 @@
|
||||||
(packages."x86_64-linux"."flame" processor)
|
(packages."x86_64-linux"."flame" processor)
|
||||||
(packages."x86_64-linux"."prime-tx" processor)
|
(packages."x86_64-linux"."prime-tx" processor)
|
||||||
(packages."x86_64-linux"."radio-rx" processor)
|
(packages."x86_64-linux"."radio-rx" processor)
|
||||||
|
(packages."x86_64-linux"."interrupts" processor)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,8 +76,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
packages."x86_64-linux"."animation" =
|
packages."x86_64-linux"."animation" =
|
||||||
# { gcc, mcu, chip_select, f_cpu }:
|
{ gcc, mcu, chip_select, f_cpu }:
|
||||||
{ gcc }:
|
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
in pkgs.stdenv.mkDerivation rec {
|
in pkgs.stdenv.mkDerivation rec {
|
||||||
|
@ -267,7 +267,8 @@
|
||||||
(packages."x86_64-linux"."base" { inherit mcu chip_select f_cpu; })
|
(packages."x86_64-linux"."base" { inherit mcu chip_select f_cpu; })
|
||||||
(packages."x86_64-linux"."sk9822" { inherit mcu chip_select f_cpu; })
|
(packages."x86_64-linux"."sk9822" { inherit mcu chip_select f_cpu; })
|
||||||
(packages."x86_64-linux"."rng" { inherit mcu chip_select f_cpu; })
|
(packages."x86_64-linux"."rng" { inherit mcu chip_select f_cpu; })
|
||||||
(packages."x86_64-linux"."animation" { inherit mcu chip_select f_cpu; })
|
(packages."x86_64-linux"."animation" { inherit mcu chip_select f_cpu;
|
||||||
|
gcc = "${avr.gcc}/bin/avr-gcc"; })
|
||||||
];
|
];
|
||||||
|
|
||||||
CFLAGS = cflags { inherit mcu chip_select f_cpu; };
|
CFLAGS = cflags { inherit mcu chip_select f_cpu; };
|
||||||
|
|
22
flame/main.c
22
flame/main.c
|
@ -30,9 +30,9 @@ typedef struct {
|
||||||
rgb_t lamp;
|
rgb_t lamp;
|
||||||
color_scheme_e color_scheme;
|
color_scheme_e color_scheme;
|
||||||
|
|
||||||
line_t red_line;
|
time_line_t red_line;
|
||||||
line_t green_line;
|
time_line_t green_line;
|
||||||
line_t blue_line;
|
time_line_t blue_line;
|
||||||
|
|
||||||
uint8_t frame;
|
uint8_t frame;
|
||||||
uint8_t duration;
|
uint8_t duration;
|
||||||
|
@ -42,9 +42,9 @@ animation_t animation_new(void) {
|
||||||
return (animation_t){
|
return (animation_t){
|
||||||
.lamp = (rgb_t){ .brightness = 1, .r = 200, .g = 30, .b = 0 },
|
.lamp = (rgb_t){ .brightness = 1, .r = 200, .g = 30, .b = 0 },
|
||||||
.color_scheme = normal,
|
.color_scheme = normal,
|
||||||
.red_line = line_new(0, 0, 0, 0),
|
.red_line = time_line_new(0, 0, 0, 0),
|
||||||
.green_line = line_new(0, 0, 0, 0),
|
.green_line = time_line_new(0, 0, 0, 0),
|
||||||
.blue_line = line_new(0, 0, 0, 0),
|
.blue_line = time_line_new(0, 0, 0, 0),
|
||||||
|
|
||||||
.frame = 0,
|
.frame = 0,
|
||||||
.duration = 0,
|
.duration = 0,
|
||||||
|
@ -58,8 +58,8 @@ void animation_flicker(animation_t *animation, rng_t *rng) {
|
||||||
case normal:
|
case normal:
|
||||||
rdest = random_step(animation->lamp.r, 180, 255, rng);
|
rdest = random_step(animation->lamp.r, 180, 255, rng);
|
||||||
gdest = random_step(animation->lamp.g, 20, 50, rng);
|
gdest = random_step(animation->lamp.g, 20, 50, rng);
|
||||||
animation->red_line = line_new(0, animation->lamp.r, 30, rdest);
|
animation->red_line = time_line_new(0, animation->lamp.r, 30, rdest);
|
||||||
animation->green_line = line_new(0, animation->lamp.g, 30, gdest);
|
animation->green_line = time_line_new(0, animation->lamp.g, 30, gdest);
|
||||||
animation->duration = 30;
|
animation->duration = 30;
|
||||||
break;
|
break;
|
||||||
case creepy:
|
case creepy:
|
||||||
|
@ -76,9 +76,9 @@ void animation_step(animation_t *animation, rng_t *rng) {
|
||||||
animation->duration = 0;
|
animation->duration = 0;
|
||||||
} else {
|
} else {
|
||||||
animation->frame++;
|
animation->frame++;
|
||||||
animation->lamp.r = line_next(&animation->red_line);
|
animation->lamp.r = time_line_next(&animation->red_line);
|
||||||
animation->lamp.g = line_next(&animation->green_line);
|
animation->lamp.g = time_line_next(&animation->green_line);
|
||||||
animation->lamp.b = line_next(&animation->blue_line);
|
animation->lamp.b = time_line_next(&animation->blue_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue