From fbc4eb1e8654521ea3d0b44a83e771c5e6e507fc Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Wed, 7 Oct 2020 19:38:56 -0400 Subject: [PATCH] init Halloween 2020 to simple orange/purple --- harrogate/Cargo.toml | 1 + harrogate/src/halloween_2020.rs | 27 +++++++++++++++++++++++++++ harrogate/src/main.rs | 4 ++++ 3 files changed, 32 insertions(+) create mode 100644 harrogate/src/halloween_2020.rs diff --git a/harrogate/Cargo.toml b/harrogate/Cargo.toml index dced8aa..73f313e 100644 --- a/harrogate/Cargo.toml +++ b/harrogate/Cargo.toml @@ -20,6 +20,7 @@ december-24-2019 = ["replace-default"] valentines-2020 = ["replace-default"] st-patricks-day = ["replace-default"] july-4 = ["replace-default"] +halloween-2020 = ["replace-default"] [dependencies] house = { path = "../house" } diff --git a/harrogate/src/halloween_2020.rs b/harrogate/src/halloween_2020.rs new file mode 100644 index 0000000..e9a690c --- /dev/null +++ b/harrogate/src/halloween_2020.rs @@ -0,0 +1,27 @@ +//! orange-and-purple with "lightning" flashes +use super::delay; +use house::{Harrogate, PORCH_BACK_LEN, PORCH_FRONT_LEN}; +use lights::{rgb::Rgb, HardwareRgb, Lights}; + +const BLACK: Rgb = Rgb(0, 0, 0); +const ORANGE: Rgb = Rgb(255, 150, 0); +const PURPLE: Rgb = Rgb(100, 0, 128); + +#[allow(dead_code)] +#[inline(always)] +pub fn run(lights: &mut impl Lights) -> ! { + let front_pattern = [PURPLE, ORANGE].iter().cycle().cloned(); + + let back_buffer = [BLACK; PORCH_BACK_LEN]; + + loop { + + Harrogate { + porch_front: front_pattern.clone().take(PORCH_FRONT_LEN), + porch_back: back_buffer.iter().cloned() + } + .render_to(lights); + + delay(12_000_000); + } +} diff --git a/harrogate/src/main.rs b/harrogate/src/main.rs index 3222703..af6f6b9 100644 --- a/harrogate/src/main.rs +++ b/harrogate/src/main.rs @@ -11,6 +11,7 @@ mod december_24_2019; mod valentines_2020; mod st_patricks_day; mod july_4; +mod halloween_2020; mod door_light; #[entry] @@ -35,6 +36,9 @@ fn main() -> ! { #[cfg(feature = "july-4")] july_4::run(&mut lights); + #[cfg(feature = "halloween-2020")] + halloween_2020::run(&mut lights); + #[cfg(not(feature = "replace-default"))] door_light::run(&mut lights); }