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(()) }