mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2025-07-02 01:04:16 +00:00
fixed timings for LED
This commit is contained in:
parent
a92192a54a
commit
b4a50ba136
@ -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(())
|
||||
|
Loading…
x
Reference in New Issue
Block a user