fix: rework device
This commit is contained in:
parent
259fdeb7b0
commit
4b135ce283
@ -29,7 +29,7 @@ pub struct Status {
|
||||
pub trait Device {
|
||||
fn status( &self ) -> Status;
|
||||
fn draw(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: Vec<Point>,
|
||||
speed: u32,
|
||||
) -> LJResult<()> ;
|
@ -30,7 +30,8 @@ impl HeliosDevice {
|
||||
};
|
||||
let dac = device.open()?;
|
||||
Ok(Self {
|
||||
conf: (*conf).clone(), dac,
|
||||
conf: (*conf).clone(),
|
||||
dac,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -44,7 +45,7 @@ impl Device for HeliosDevice {
|
||||
};
|
||||
}
|
||||
|
||||
fn draw(&self,
|
||||
fn draw(&mut self,
|
||||
line: Vec<Point>,
|
||||
speed: u32,
|
||||
) -> LJResult<()> {
|
||||
@ -52,6 +53,11 @@ impl Device for HeliosDevice {
|
||||
|
||||
let points: Vec<helios_dac::Point> = line.into_iter().map(|p| p.into()).collect();
|
||||
let frame = Frame::new(speed, points);
|
||||
|
||||
while let Ok(DeviceStatus::NotReady) = self.dac.status() {
|
||||
self.dac.write_frame(frame.clone())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user