fixed timings for LED

This commit is contained in:
PC_WSL 2025-05-12 15:30:49 +02:00
parent a92192a54a
commit b4a50ba136

View File

@ -11,7 +11,7 @@ pub struct Led {
controller: Ws2812<Spi>,
}
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<Self, Box<dyn std::error::Error>> {
@ -27,6 +27,13 @@ impl Led {
Ok(())
}
pub async fn turn_red_on_1s(&mut self) -> Result<(), Box<dyn std::error::Error>> {
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<dyn std::error::Error>> {
self.controller.write(NamedColor::Off.into_iter())?;
Ok(())