diff --git a/src/led.rs b/src/led.rs index ace6b34..c322eac 100644 --- a/src/led.rs +++ b/src/led.rs @@ -11,7 +11,7 @@ pub struct Led { controller: Ws2812, } -const STATUS_DURATION: Duration = Duration::from_secs(2); // 2s sleep for all status led signals +const STATUS_DURATION: Duration = Duration::from_secs(1); // 1s sleep for all status led signals impl Led { pub fn new() -> Result> { @@ -27,6 +27,13 @@ impl Led { Ok(()) } + pub async fn turn_red_on_1s(&mut self) -> Result<(), Box> { + self.controller.write(NamedColor::Red.into_iter())?; + sleep(STATUS_DURATION).await; + self.controller.write(NamedColor::Off.into_iter())?; + Ok(()) + } + pub fn turn_off(&mut self) -> Result<(), Box> { self.controller.write(NamedColor::Off.into_iter())?; Ok(())