add heartbeat led to july 4

This commit is contained in:
Tangent Wantwight 2021-07-06 00:19:42 -04:00
parent 3cb7fc1a57
commit 6cc39d3a9b

View file

@ -15,18 +15,19 @@ const FULL_PORCH: usize = 150;
#[allow(dead_code)] #[allow(dead_code)]
#[inline(always)] #[inline(always)]
pub fn run(lights: &mut impl Lights<Pixel = HardwareRgb>) -> ! { pub fn run(lights: &mut impl Lights<Pixel = HardwareRgb>) -> ! {
let stars = [BLUE, WHITE, BLUE] let mut heartbeat = false;
.iter() loop {
.cycle() heartbeat = !heartbeat;
.take(FULL_PORCH)
.cloned(); let stars = [BLUE, WHITE, BLUE].iter().cycle().take(FULL_PORCH).cloned();
let stripes = repeat(RED) let stripes = repeat(RED)
.take(11) .take(11)
.chain(repeat(WHITE).take(11)) .chain(repeat(WHITE).take(11))
.cycle() .cycle()
.take(11 * 12) .take(11 * 12)
.chain(repeat(RED).take(11)) .chain(repeat(RED).take(11))
.chain(repeat(OFF)) .chain(repeat(OFF).take(6))
.chain(repeat(if heartbeat { RED } else { OFF }))
.take(FULL_PORCH); .take(FULL_PORCH);
let pattern = Harrogate { let pattern = Harrogate {
@ -34,9 +35,8 @@ pub fn run(lights: &mut impl Lights<Pixel = HardwareRgb>) -> ! {
porch_front: stars, porch_front: stars,
}; };
loop { pattern.render_to(lights);
pattern.clone().render_to(lights);
delay(1_000_000); delay(24_000_000);
} }
} }