diff --git a/Cargo.toml b/Cargo.toml index 9789221..65d03bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,11 @@ config = "0.13.3" ctrlc = "3.4.0" env_logger = "0.10.0" helios-dac = { version = "0.1", default-features = false, features = ["native"] } + log = "0.4.18" redis = "0.23.0" ron = "0.8.0" serde = { version = "1.0.163", features = ["derive"] } toml = "0.7.4" +homography = { git = "https://github.com/azazdeaz/homography" } +nalgebra = "0.32.2" diff --git a/src/device/dummy.rs b/src/device/dummy.rs index 8a9ed9b..e4c9e42 100644 --- a/src/device/dummy.rs +++ b/src/device/dummy.rs @@ -1,6 +1,7 @@ use crate::device::{Device, Status, PlaybackState}; -use crate::errors::{LJError, LJResult}; +use crate::errors::LJResult; use crate::point::Point; +use log::debug; pub struct DummyDevice { state: PlaybackState @@ -27,7 +28,8 @@ impl Device for DummyDevice { line: Vec, speed: u32, ) -> LJResult<()> { - Ok(()) + debug!("Draw Line at speed {speed} : {:?}", line); + Ok(()) } fn stop(&mut self) -> LJResult<()> { diff --git a/src/redis_ctrl.rs b/src/redis_ctrl.rs index e7e80fa..ee2efe7 100644 --- a/src/redis_ctrl.rs +++ b/src/redis_ctrl.rs @@ -113,6 +113,7 @@ impl RedisCtrl { // Get new EDH let edh : String = self.connection.get("/EDH/0")?; let edh : Vec> = from_str(&edh)?; - Ok(EDH { matrix: edh }) + let edh = EDH::new(edh)?; + Ok(edh) } } diff --git a/src/worldstate.rs b/src/worldstate.rs index 41eeef7..38b1bd0 100644 --- a/src/worldstate.rs +++ b/src/worldstate.rs @@ -1,13 +1,19 @@ use crate::point::Color; - +use nalgebra::base::Matrix3; +use crate::errors::LJResult; #[derive(Debug, Default)] pub struct EDH { - pub matrix: Vec> //Matrix3 + pub matrix: Matrix3 } impl EDH { - + pub fn new(vec: Vec>) -> LJResult { + let matrix = Matrix3::new(vec[0][0], vec[0][1], vec[0][2], + vec[1][0], vec[1][1], vec[1][2], + vec[2][0], vec[2][1], vec[2][2]); + Ok(EDH { matrix }) + } } #[derive(Debug, Default)] @@ -20,6 +26,6 @@ pub struct WorldState { pub color: Color } -impl WorldState{ +impl WorldState { }