New door light color
This commit is contained in:
parent
221b18d085
commit
fefe4e100e
3 changed files with 47 additions and 0 deletions
|
@ -29,6 +29,8 @@ halloween-2023 = ["replace-default"]
|
||||||
new-years-eve-2020 = ["replace-default"]
|
new-years-eve-2020 = ["replace-default"]
|
||||||
november-2020 = ["replace-default"]
|
november-2020 = ["replace-default"]
|
||||||
|
|
||||||
|
door-light-orange = ["replace-default"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
house = { path = "../house" }
|
house = { path = "../house" }
|
||||||
itsybitsy_m0 = "0.10"
|
itsybitsy_m0 = "0.10"
|
||||||
|
|
41
harrogate/src/door_light_orange.rs
Normal file
41
harrogate/src/door_light_orange.rs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
use super::delay;
|
||||||
|
use core::iter::repeat;
|
||||||
|
use house::Harrogate;
|
||||||
|
use lights::rgb::{linear_gradient, Rgb};
|
||||||
|
use lights::{HardwareRgb, Lights};
|
||||||
|
|
||||||
|
const OFF: Rgb = Rgb(0, 0, 0);
|
||||||
|
const ON: Rgb = Rgb(255, 192, 128);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 20 fade + 25 ON + 20 fade = 65 dots
|
||||||
|
* 85 OFF + 65 door = 150 dots
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn run(lights: &mut impl Lights<Pixel = HardwareRgb>) -> ! {
|
||||||
|
let mut i = 0;
|
||||||
|
loop {
|
||||||
|
i = match i {
|
||||||
|
i if i < 84 => i + 1,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
let void = (0..).map(|j| if i == j { OFF } else { OFF });
|
||||||
|
|
||||||
|
let door_highlight = linear_gradient(OFF, ON, 20)
|
||||||
|
.chain(repeat(ON).take(25))
|
||||||
|
.chain(linear_gradient(ON, OFF, 20));
|
||||||
|
|
||||||
|
let pattern = Harrogate {
|
||||||
|
porch_back: void.take(85).chain(door_highlight),
|
||||||
|
porch_front: repeat(OFF),
|
||||||
|
};
|
||||||
|
|
||||||
|
pattern.render_to(lights);
|
||||||
|
|
||||||
|
delay(48_000_000);
|
||||||
|
//lights.latch();
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ mod halloween_2023;
|
||||||
mod november_2020;
|
mod november_2020;
|
||||||
mod new_years_eve_2020;
|
mod new_years_eve_2020;
|
||||||
mod door_light;
|
mod door_light;
|
||||||
|
mod door_light_orange;
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
|
@ -69,4 +70,7 @@ fn main() -> ! {
|
||||||
|
|
||||||
#[cfg(not(feature = "replace-default"))]
|
#[cfg(not(feature = "replace-default"))]
|
||||||
door_light::run(&mut lights);
|
door_light::run(&mut lights);
|
||||||
|
|
||||||
|
#[cfg(feature = "door-light-orange")]
|
||||||
|
door_light_orange::run(&mut lights);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue