From 0f3ee7c54a01c4c982e9ba335e38229d8763d9f1 Mon Sep 17 00:00:00 2001 From: alban Date: Mon, 12 Jun 2023 19:27:44 +0200 Subject: [PATCH] fix: helios.status state --- src/device/helios.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/device/helios.rs b/src/device/helios.rs index 2e1041c..deab194 100644 --- a/src/device/helios.rs +++ b/src/device/helios.rs @@ -32,7 +32,7 @@ impl HeliosDevice { return Err(Box::new(LJError::HeliosDeviceMissing)); }; let dac = device.open()?; - Ok(Self { conf: (*conf).clone(), dac, sent_points: 0, state: PlaybackState::IDLE, lack: "".to_string() }) + Ok(Self { conf: (*conf).clone(), dac, sent_points: 0, state: PlaybackState::PREPARE, lack: "".to_string() }) } } @@ -53,13 +53,14 @@ impl Device for HeliosDevice { line: Vec, speed: u32, ) -> LJResult<()> { + self.state = PlaybackState::IDLE; while let Ok(DeviceStatus::NotReady) = self.dac.status() {} + self.state = PlaybackState::PLAYING; let points: Vec = line.into_iter().map(|p| p.into()).collect(); let frame = Frame::new(speed, points.clone()); self.dac.write_frame(frame.clone())?; self.sent_points = points.len() as u16; - self.state = PlaybackState::PLAYING; Ok(()) }