fetch the right edh for this laser

This commit is contained in:
Marc Planard 2023-07-01 14:54:37 +02:00
parent 42773aa2a2
commit ddf44460ae
2 changed files with 5 additions and 1 deletions

View File

@ -111,7 +111,8 @@ impl RedisCtrl {
pub fn get_edh( &mut self ) -> LJResult<EDH> { pub fn get_edh( &mut self ) -> LJResult<EDH> {
// Get new EDH // Get new EDH
let edh : String = self.connection.get("/EDH/0")?; let edh_key = format!("/EDH/{}", self.laser_id);
let edh : String = self.connection.get(edh_key)?;
let edh : Vec<Vec<f32>> = from_str(&edh)?; let edh : Vec<Vec<f32>> = from_str(&edh)?;
let edh = EDH::new(edh)?; let edh = EDH::new(edh)?;
Ok(edh) Ok(edh)

View File

@ -15,6 +15,9 @@ impl EDH {
vec[2].len() != 3 { vec[2].len() != 3 {
return Err(Box::new(LJError::BadEDH)); return Err(Box::new(LJError::BadEDH));
} }
//
// [FIX] Not sure of the order, if is it's vec[x][y] or vec[y][x] ...
//
let matrix = Matrix3::new(vec[0][0], vec[0][1], vec[0][2], let matrix = Matrix3::new(vec[0][0], vec[0][1], vec[0][2],
vec[1][0], vec[1][1], vec[1][2], vec[1][0], vec[1][1], vec[1][2],
vec[2][0], vec[2][1], vec[2][2]); vec[2][0], vec[2][1], vec[2][2]);