Compare commits

..

No commits in common. "4a87821c22264078c892ec12dd4999d15db867a3" and "69b619dbf5fc26996cbfb4bb0244a108c3162150" have entirely different histories.

17 changed files with 213 additions and 460 deletions

View File

@ -10,7 +10,6 @@ chrono = "0.4.26"
config = "0.13.3" config = "0.13.3"
ctrlc = "3.4.0" ctrlc = "3.4.0"
env_logger = "0.10.0" env_logger = "0.10.0"
ether-dream = "0.2.5"
helios-dac = { version = "0.1", default-features = false, features = ["native"] } helios-dac = { version = "0.1", default-features = false, features = ["native"] }
log = "0.4.18" log = "0.4.18"

View File

@ -1,16 +0,0 @@
# LJ rust
## Crashcourse
```shell
# Copy and edit the settings file
$ cp copyme.settings.toml settings.toml
# Populate the redis database
$ cargo run --example populate_redis
# Run
$ cargo run --release
```

View File

@ -1,4 +1,4 @@
# file: settings.toml # file: Settings.toml
# Rename me ! # Rename me !
# The main key of your laser in LJ # The main key of your laser in LJ
@ -12,26 +12,20 @@ redis_url = "redis://127.0.0.1:6379/"
# Either Helios or Etherdream # Either Helios or Etherdream
# For Helios. USB Device Id of the DAC # For Helios. USB Device Id of the DAC
#[dac.helios] [dac.helios]
#id = 0 id = 0
# For dummy dac: # For dummy dac:
[dac.dummy] # [dac.dummy]
# For Etherdream. IP of the DAC # For Etherdream. IP of the DAC
# [dac.etherdream] # [dac.etherdream]
# ip = "192.168.1.68" # url = "192.168.1.68"
[[transformers]] [[transformers]]
[transformers.translate] [transformers.translate]
x = 2000 x = 2000
y = 2000 y = 2000
[[transformers]] [[transformers]]
[transformers.replicate] [transformers.replicate]
Until = 48 Until = 48
# Never remove this : this is mandatory
[[transformers]]
[transformers.intensity]

View File

@ -1,24 +0,0 @@
///
/// $ cargo run --example populate_redis
///
use redis::{
//RedisResult,
Client,
Commands,
Connection,
};
fn do_something() -> redis::RedisResult<()> {
let client = Client::open("redis://127.0.0.1/")?;
let mut con: Connection = client.get_connection()?;
let _ = con.set("/clientkey", "/pl/0/")?;
let _ = con.set("/EDH/0", "[[1.0, 0.0, 0.0],\n [ 0.0, 1.0, 0.0],\n [ 0.0, 0.0, 1.0]]")?;
let _ = con.set("/kpps/0", "5000")?;
let _ = con.set("/intensity/0", "255")?;
Ok(())
}
fn main() {
_ = do_something();
}

View File

@ -30,7 +30,7 @@ pub struct HeliosConf {
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct EtherDreamConf { pub struct EtherDreamConf {
pub ip: String pub url: String
} }
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]

View File

@ -1,6 +1,6 @@
mod helios; mod helios;
mod dummy; mod dummy;
mod etherdream;
use std::fmt; use std::fmt;
use crate::conf::{Conf, DacFamily /*EtherDreamConf, HeliosConf*/}; use crate::conf::{Conf, DacFamily /*EtherDreamConf, HeliosConf*/};
@ -9,7 +9,6 @@ use crate::device::dummy::DummyDevice;
use crate::errors::LJResult; use crate::errors::LJResult;
use crate::point::Point; use crate::point::Point;
use serde::Serialize; use serde::Serialize;
use crate::device::etherdream::EtherdreamDevice;
/* /*
self.protocol_version, self.protocol_version,
@ -27,11 +26,9 @@ self.point_count
#[derive(Debug, PartialEq, Serialize, Copy, Clone)] #[derive(Debug, PartialEq, Serialize, Copy, Clone)]
pub enum PlaybackState { pub enum PlaybackState {
IDLE = 0, IDLE = 0,
PREPARE = 1, PREPARE,
PLAYING = 2, PLAYING,
UNKNOWN = 99,
} }
impl fmt::Display for PlaybackState { impl fmt::Display for PlaybackState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self) write!(f, "{:?}", self)
@ -44,7 +41,7 @@ pub struct Status {
pub properties: Vec<String>, pub properties: Vec<String>,
pub playback_state: PlaybackState, pub playback_state: PlaybackState,
pub capacity: u16, pub capacity: u16,
pub lack: String, pub lack: String
} }
// /lstt/lasernumber etherdream last_status.playback_state (0: idle 1: prepare 2: playing) // /lstt/lasernumber etherdream last_status.playback_state (0: idle 1: prepare 2: playing)
@ -52,20 +49,19 @@ pub struct Status {
// /lack/lasernumber "a": ACK "F": Full "I": invalid. 64 or 35 for no connection. // /lack/lasernumber "a": ACK "F": Full "I": invalid. 64 or 35 for no connection.
pub trait Device { pub trait Device {
fn status(&mut self) -> Status; fn status(&self) -> Status;
fn draw( fn draw(
&mut self, &mut self,
frame: Vec<Point>, frame: Vec<Point>,
speed: u32, speed: u32,
) -> LJResult<()>; ) -> LJResult<()>;
fn stop(&mut self) -> LJResult<()>; fn stop(&mut self) -> LJResult<()>;
fn grid(&mut self) -> Vec<Point>;
} }
pub fn device_factory(config: &Conf) -> LJResult<Box<dyn Device>> { pub fn device_factory(config: &Conf) -> LJResult<Box<dyn Device>> {
let device : Box<dyn Device> = match &config.dac { let device : Box<dyn Device> = match &config.dac {
DacFamily::Helios(conf) => Box::new(HeliosDevice::new(conf)?), DacFamily::Helios(conf) => Box::new(HeliosDevice::new(conf)?),
DacFamily::Etherdream( conf) => Box::new( EtherdreamDevice::new(conf)?), DacFamily::Etherdream(_conf) => todo!(),
DacFamily::Dummy => Box::new(DummyDevice::new()?) DacFamily::Dummy => Box::new(DummyDevice::new()?)
}; };
Ok(device) Ok(device)

31
src/device/common.rs Normal file
View File

@ -0,0 +1,31 @@
/*
self.protocol_version,
self.le_state,
self.playback_state,
self.source,
self.le_flags,
self.playback_flags,
self.source_flags,
self.fullness,
self.point_rate,
self.point_count
*/
pub struct Status {
pub active: bool,
pub last_traced_at: String,
pub properties: Vec<String>
}
pub trait Device {
/**
fn intersect(&self, orig : &Vec3, dir : &Vec3) -> Option<Float>;
fn get_surface(&self, v : &Vec3) -> Vec3;
fn get_normal(&self, v : &Vec3) -> Vec3;
fn get_material(&self) -> &dyn Material;
**/
fn status( &self ) -> Status;
}

View File

@ -1,6 +1,6 @@
use crate::device::{Device, Status, PlaybackState}; use crate::device::{Device, Status, PlaybackState};
use crate::errors::LJResult; use crate::errors::LJResult;
use crate::point::{Color, Point}; use crate::point::Point;
use log::debug; use log::debug;
pub struct DummyDevice { pub struct DummyDevice {
@ -14,7 +14,7 @@ impl DummyDevice {
} }
impl Device for DummyDevice { impl Device for DummyDevice {
fn status(&mut self) -> Status { fn status(&self) -> Status {
Status { Status {
last_traced_at: "never".to_string(), last_traced_at: "never".to_string(),
properties: vec!["foo".to_string()], properties: vec!["foo".to_string()],
@ -35,9 +35,4 @@ impl Device for DummyDevice {
fn stop(&mut self) -> LJResult<()> { fn stop(&mut self) -> LJResult<()> {
Ok(()) Ok(())
} }
fn grid(&mut self) -> Vec<Point> {
vec!(
Point{ x: 0 as f32, y: 0 as f32, color:Color{ r: 0, g: 0, b: 0 }}
)
}
} }

View File

@ -1,153 +0,0 @@
use std::time;
use std::net::SocketAddr;
use ether_dream::dac::stream::connect;
use ether_dream::dac::Stream;
use crate::conf::EtherDreamConf;
use crate::device::{Device, Status, PlaybackState};
use crate::errors::{LJError, LJResult};
use crate::point::{Color, Point};
use ether_dream::protocol::{DacBroadcast, DacStatus};
use log::{info, warn};
#[warn(dead_code)]
pub struct EtherdreamDevice {
pub conf: EtherDreamConf,
dac: DacBroadcast,
// source_address: SocketAddr,
stream: Stream,
// sent_points: u16,
lack: String,
last_traced_at: String,
}
impl EtherdreamDevice {
pub fn new(conf: &EtherDreamConf) -> LJResult<Self> {
let (dac, _source_address, stream) = EtherdreamDevice::get_dac(conf)?;
// let (dac, source_address) = EtherdreamDevice::get_dac(conf)?;
Ok(Self {
conf: (*conf).clone(),
dac,
// source_address,
stream,
// sent_points: 0,
lack: "".to_string(),
last_traced_at: "1985-04-12T23:20:50.52Z".to_string(),
})
}
pub fn get_dac(conf: &EtherDreamConf) -> LJResult<(DacBroadcast, SocketAddr, Stream)> {
let ip = &conf.ip;
let dac_broadcast = ether_dream::recv_dac_broadcasts()?;
dac_broadcast.set_timeout(Some(time::Duration::new(10, 0)))?;
info!("Attempting to get DAC broadcast...");
let broadcast = dac_broadcast
.filter_map(|result| {
match result {
Err(err) => {
warn!( "Failed to find a valid DAC via broadcast. Error: {:?}", err);
info!( "Retrying...");
None
},
Ok((dac, source_addr)) => {
if source_addr.is_ipv6() { return None; }
if &source_addr.ip().to_string() != ip { return None; }
info!("Valid broadcast");
Some(Ok((dac, source_addr)))
}
}
})
.next()
.expect("Failed to receive broadcast.");
match broadcast {
Err(err) => {
Err(Box::new(LJError::EtherdreamConnectError(err)))
}
Ok((dac, source_addr)) => {
let stream = EtherdreamDevice::get_tcp_stream(&dac, &source_addr)?;
Ok((dac, source_addr, stream))
}
}
}
pub fn get_tcp_stream(dac: &DacBroadcast, source_address: &SocketAddr) -> LJResult<Stream> {
// Establish the TCP connection.
let mut stream = connect(dac, source_address.ip())?;
// Prepare stream
stream
.queue_commands()
.prepare_stream()
.submit()
.err()
.map(|err| {
eprintln!(
"err occurred when submitting PREPARE_STREAM \
command and listening for response: {}",
err
);
});
Ok(stream)
}
pub fn check_tcp_stream(&mut self) -> LJResult<()> {
// todo Reinit stream if needed
// self.stream = EtherdreamDevice::get_tcp_stream(&self.dac, &self.source_address)?
Ok(())
}
// Determine the number of points needed to fill the DAC.
fn points_to_generate(&self) -> usize {
self.dac.buffer_capacity as usize - 1 - self.dac.dac_status.buffer_fullness as usize
}
}
impl Device for EtherdreamDevice {
fn status(&mut self) -> Status {
let _ = self.check_tcp_stream();
// "a": ACK "F": Full "I": invalid. 64 or 35 for no connection.
let playback_state = match self.dac.dac_status.playback_state {
DacStatus::PLAYBACK_IDLE => PlaybackState::IDLE,
DacStatus::PLAYBACK_PREPARED => PlaybackState::PREPARE,
DacStatus::PLAYBACK_PLAYING => PlaybackState::PLAYING,
_ => PlaybackState::UNKNOWN
};
Status {
last_traced_at: self.last_traced_at.clone(),
properties: vec!["foo".to_string()],
playback_state,
capacity: self.dac.dac_status.buffer_fullness,
lack: String::from(&self.lack),
}
}
fn draw(&mut self,
line: Vec<Point>,
_speed: u32,
) -> LJResult<()> {
let n_points = self.points_to_generate();
self.stream
.queue_commands()
.data(line.into_iter().map(|point| point.into()).take(n_points))
.submit()?;
Ok(())
}
fn stop(&mut self) -> LJResult<()> {
self.stream
.queue_commands()
.stop()
.submit()
.expect("err occurred when submitting STOP command and listening for response");
Ok(())
}
fn grid(&mut self) -> Vec<Point> {
vec!(
Point { x: 0.0, y: 0.0, color: Color { r: 255, g: 255, b: 255 } }
)
}
}

View File

@ -13,7 +13,7 @@ use helios_dac::{
use crate::conf::HeliosConf; use crate::conf::HeliosConf;
use crate::device::{Device, Status, PlaybackState}; use crate::device::{Device, Status, PlaybackState};
use crate::errors::{LJError, LJResult}; use crate::errors::{LJError, LJResult};
use crate::point::{Color, Point}; use crate::point::Point;
use chrono::Utc; use chrono::Utc;
pub struct HeliosDevice { pub struct HeliosDevice {
@ -22,7 +22,7 @@ pub struct HeliosDevice {
sent_points: u16, sent_points: u16,
state: PlaybackState, state: PlaybackState,
lack: String, lack: String,
last_traced_at: String, last_traced_at : String
} }
impl HeliosDevice { impl HeliosDevice {
@ -40,13 +40,14 @@ impl HeliosDevice {
sent_points: 0, sent_points: 0,
state: PlaybackState::PREPARE, state: PlaybackState::PREPARE,
lack: "".to_string(), lack: "".to_string(),
last_traced_at: "1985-04-12T23:20:50.52Z".to_string(), last_traced_at: "1985-04-12T23:20:50.52Z".to_string()
}) })
} }
} }
impl Device for HeliosDevice { impl Device for HeliosDevice {
fn status(&mut self) -> Status { fn status(&self) -> Status {
let lack = self.lack.clone(); let lack = self.lack.clone();
Status { Status {
last_traced_at: self.last_traced_at.clone(), last_traced_at: self.last_traced_at.clone(),
@ -77,27 +78,4 @@ impl Device for HeliosDevice {
self.dac.stop()?; self.dac.stop()?;
Ok(()) Ok(())
} }
fn grid(&mut self) -> Vec<Point> {
let dim_min = 0 as f32;
let dim_mid = 2047 as f32;
let dim_max = 4095 as f32;
let col_min = Color { r: 0, g: 0, b: 0 };
let col_max = Color { r: 255, g: 255, b: 255 };
vec![
Point { x: dim_min, y: dim_max, color: col_min },
Point { x: dim_min, y: dim_max, color: col_max },
Point { x: dim_max, y: dim_max, color: col_max },
Point { x: dim_max, y: dim_min, color: col_max },
Point { x: dim_min, y: dim_min, color: col_max },
Point { x: dim_min, y: dim_min, color: col_min },
Point { x: dim_min, y: dim_mid, color: col_min },
Point { x: dim_min, y: dim_mid, color: col_max },
Point { x: dim_mid, y: dim_mid, color: col_max },
Point { x: dim_mid, y: dim_min, color: col_max },
Point { x: dim_min, y: dim_min, color: col_max },
Point { x: dim_min, y: dim_min, color: col_min },
]
}
} }

View File

@ -1,5 +1,5 @@
use std::error::Error; use std::error::Error;
use std::{fmt, io}; use std::fmt;
use redis::RedisError; use redis::RedisError;
use config::ConfigError; use config::ConfigError;
@ -10,8 +10,7 @@ pub enum LJError {
Config(ConfigError), Config(ConfigError),
RedisConnect(RedisError), RedisConnect(RedisError),
HeliosDeviceMissing, HeliosDeviceMissing,
BadEDH, BadEDH
EtherdreamConnectError(io::Error),
} }
impl fmt::Display for LJError { impl fmt::Display for LJError {
@ -21,19 +20,17 @@ impl fmt::Display for LJError {
match self { match self {
Config(err) => { Config(err) => {
write!(f, "unable to load config file: {err}") write!(f, "unable to load config file: {err}")
} },
RedisConnect(err) => { RedisConnect(err) => {
write!(f, "unable to connect to redis server: {err}") write!(f, "unable to connect to redis server: {err}")
} },
HeliosDeviceMissing => { HeliosDeviceMissing => {
write!(f, "helios device not found") write!(f, "helios device not found")
} },
BadEDH => { BadEDH => {
write!(f, "EDH matrix is not a 3x3 matrix") write!(f, "EDH matrix is not a 3x3 matrix")
} }
EtherdreamConnectError(err) => {
write!(f, "Failed to retrieve Etherdream device: {err}")
}
} }
} }
} }

View File

@ -50,7 +50,7 @@ fn run_all() -> LJResult<()> {
// Setup Redis Service // Setup Redis Service
let mut rs = RedisCtrl::new(&config.redis_url, &config.laser_id)?; let mut rs = RedisCtrl::new(&config.redis_url, &config.laser_id)?;
let mut world_state = rs.init_world_state().unwrap(); let mut world_state = rs.init_world_state()?;
info!("WorldState: {:?}", world_state); info!("WorldState: {:?}", world_state);
// Setup handler for interrupt Signals // Setup handler for interrupt Signals
@ -62,7 +62,6 @@ fn run_all() -> LJResult<()> {
// Setup Laser Device based on conf // Setup Laser Device based on conf
let mut tracer = device_factory(&config)?; let mut tracer = device_factory(&config)?;
world_state.grid = tracer.grid();
// can't work, but we can add + Debug to Device to make it work... // can't work, but we can add + Debug to Device to make it work...
//dbg!(tracer); //dbg!(tracer);
@ -75,46 +74,46 @@ fn run_all() -> LJResult<()> {
rs.set_status(tracer.status())?; rs.set_status(tracer.status())?;
let order = rs.get_order(config.laser_id)?; let order = rs.get_order(config.laser_id)?;
match order {
Order::Draw | Order::Black | Order::Grid => {
// 0 : Draw Normal point list // 0 : Draw Normal point list
// 2 : Draw BLACK point list // 2 : Draw BLACK point list
// 3 : Draw GRID point list // 3 : Draw GRID point list
world_state.draw_black = order == Order::Black;
world_state.draw_grid = order == Order::Grid; // /worldstate.rs
// /edh.rs
// 1 : Get the new EDH = reread redis key /EDH/lasernumber
// 4 : Resampler Change (longs and shorts lsteps)
// 5 : Client Key Change = reread redis key /clientkey
// 6 : Max Intensity Change = reread redis key /intensity
// 7 : kpps change = reread redis key /kpps
// 8 : color balance change = reread redis keys /red /green /blue
match order {
Order::Draw | Order::Black => {
world_state.black = order == Order::Black;
let frame = get_next_frame( let frame = get_next_frame(
&config, &config,
&transformers, &transformers,
&mut rs, &mut rs,
&world_state, &world_state
)?; )?;
// For now, draw all the time // For now, draw all the time
tracer.draw(frame, world_state.kpps)?; tracer.draw(frame, world_state.kpps)?;
} },
Order::Intensity => { Order::Intensity => {
// 6 : Max Intensity Change = reread redis key /intensity
world_state.intensity = rs.get_int("intensity")? world_state.intensity = rs.get_int("intensity")?
.try_into()?; .try_into()?;
}
Order::Edh => {
// 1 : Get the new EDH = reread redis key /EDH/lasernumber
world_state.edh = rs.get_edh()?;
}
Order::Kpps => {
// 7 : kpps change = reread redis key /kpps
world_state.kpps = rs.get_int("kpps")?;
}
Order::ClientKey => {
world_state.client_key = rs.get_client_key()?;
}, },
Order::Edh => {
world_state.edh = rs.get_edh()?;
},
Order::Kpps => {
world_state.kpps = rs.get_int("kpps")?;
},
// Order::ClientKey => rs.client_key(),
// Order::ColorBalance => {}, // Order::ColorBalance => {},
_ => { _ => {
// 4 : Resampler Change (longs and shorts lsteps)
// 5 : Client Key Change = reread redis key /clientkey
// 8 : color balance change = reread redis keys /red /green /blue
// 9 : poweroff LJ
info!("Order: {:?}", order); info!("Order: {:?}", order);
} }
} }
@ -144,44 +143,36 @@ fn get_next_frame(
config: &Conf, config: &Conf,
transformers: &[Box<dyn Transformers>], transformers: &[Box<dyn Transformers>],
rs: &mut RedisCtrl, rs: &mut RedisCtrl,
world_state: &WorldState, world_state : &WorldState
) -> LJResult<Vec<Point>> { ) -> LJResult<Vec<Point>> {
let format_key = format!("{}{}", let format_key = format!("{}{}",
world_state.client_key, world_state.client_key,
config.laser_id); config.laser_id);
let line = rs.get_line(&format_key)?;
// Handle the grid case let mut line: Vec<Point> = line.into_iter()
let mut line: Vec<Point> = if world_state.draw_grid {
world_state.grid.clone()
} else {
let redis_line = rs.get_line(&format_key)?;
redis_line.into_iter()
.map(|tpl| tpl.into()) .map(|tpl| tpl.into())
.collect() .collect();
};
for transformer in transformers { for transformer in transformers {
line = transformer.apply(&line, world_state); line = transformer.apply(&line, world_state);
} }
info!("Draw Black -> {}", world_state.draw_black); info!("-> {}", world_state.black);
info!("Draw Grid -> {}", world_state.draw_grid);
// LIMITER and BLACK // LIMITER and BLACK
line = line.into_iter() line = line.into_iter()
.map(| p | { .map(| p | {
let color = if world_state.draw_black {
let color = if world_state.black {
Color { r: 0, g: 0, b: 0 } Color { r: 0, g: 0, b: 0 }
} else { } else {
Color { Color {
r: p.color.r.min(world_state.intensity), r: p.color.r.min(world_state.intensity),
g: p.color.g.min(world_state.intensity), g: p.color.g.min(world_state.intensity),
b: p.color.b.min(world_state.intensity), b: p.color.b.min(world_state.intensity)
} }
}; };
Point { Point { color,
color,
..p ..p
} }
}) })

View File

@ -1,26 +1,15 @@
use ether_dream::protocol::DacPoint;
#[derive(Debug,Clone,Copy,Default,PartialEq)] #[derive(Debug,Clone,Copy,Default,PartialEq)]
pub struct Point { pub struct Point {
pub x: f32, pub x: f32,
pub y: f32, pub y: f32,
pub color: Color, pub color: Color
} }
#[derive(Debug,Clone,Copy,Default,PartialEq)] #[derive(Debug,Clone,Copy,Default,PartialEq)]
pub struct Color { pub struct Color {
pub r: u8, pub r: u8,
pub g: u8, pub g: u8,
pub b: u8, pub b: u8
}
impl From<Color> for u32 {
fn from(value: Color) -> Self {
let r = value.r as u32;
let g = value.g as u32;
let b = (value.b) as u32;
(r << 16) + (g << 8) + b
}
} }
impl From<(f32,f32,u32)> for Point { impl From<(f32,f32,u32)> for Point {
@ -39,26 +28,7 @@ impl From<Point> for helios_dac::Point {
helios_dac::Point { helios_dac::Point {
coordinate: (x, y).into(), coordinate: (x, y).into(),
color: helios_dac::Color::new(pt.color.r, pt.color.g, pt.color.b), color: helios_dac::Color::new(pt.color.r, pt.color.g, pt.color.b),
intensity: 0xFF, intensity: 0xFF
}
}
}
impl From<Point> for DacPoint {
fn from(pt: Point) -> DacPoint {
let control = 0;
let (u1, u2) = (0, 0);
let i = 255;
DacPoint {
control,
x: pt.x as i16,
y: pt.y as i16,
i,
r: pt.color.r.into(),
g: pt.color.g.into(),
b: pt.color.b.into(),
u1,
u2,
} }
} }
} }

View File

@ -101,10 +101,10 @@ impl RedisCtrl {
pub fn init_world_state( &mut self) -> LJResult<WorldState>{ pub fn init_world_state( &mut self) -> LJResult<WorldState>{
Ok(WorldState { Ok(WorldState {
client_key: self.get_client_key().unwrap(), client_key: self.connection.get("/clientkey")?,
edh: self.get_edh().unwrap(), edh: self.get_edh()?,
kpps: self.get_int("kpps").unwrap().try_into().unwrap(), kpps: self.get_int("kpps")?.try_into()?,
intensity: self.get_int("intensity").unwrap().try_into().unwrap(), intensity: self.get_int("intensity")?.try_into()?,
..WorldState::default() ..WorldState::default()
}) })
} }
@ -118,11 +118,6 @@ impl RedisCtrl {
Ok(edh) Ok(edh)
} }
pub fn get_client_key( &mut self ) -> LJResult<String> {
let key : String = self.connection.get("/clientkey")?;
Ok(key)
}
pub fn get_int(&mut self, key: &str ) -> LJResult<u32> { pub fn get_int(&mut self, key: &str ) -> LJResult<u32> {
// Get new Int // Get new Int
let fmt = format!("/{key}/{}", self.laser_id); let fmt = format!("/{key}/{}", self.laser_id);

View File

@ -5,7 +5,7 @@ use log::debug;
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct EDH { pub struct EDH {
pub matrix: Matrix3<f32>, pub matrix: Matrix3<f32>
} }
impl EDH { impl EDH {
@ -40,13 +40,13 @@ impl EDH {
pub struct WorldState { pub struct WorldState {
pub edh: EDH, pub edh: EDH,
pub resampler: Vec<f32>, pub resampler: Vec<f32>,
pub client_key: String, pub client_key: String, //u8,
pub intensity: u8, pub intensity: u8,
pub kpps: u32, pub kpps: u32,
pub color: Color, pub color: Color,
pub draw_black: bool, pub black: bool
pub draw_grid: bool,
pub grid: Vec<Point>,
} }
impl WorldState {} impl WorldState {
}

View File

@ -12,4 +12,4 @@ redis_url = "redis://127.0.0.1:6379/"
# For Etherdream. IP of the DAC # For Etherdream. IP of the DAC
[dac.etherdream] [dac.etherdream]
ip = "192.168.1.68" url = "192.168.1.68"

View File

@ -28,7 +28,7 @@ fn it_finds_struct_fields() {
fn it_finds_etherdream_fields() { fn it_finds_etherdream_fields() {
let config = Conf::new("tests/settings/valid_etherdream").unwrap(); let config = Conf::new("tests/settings/valid_etherdream").unwrap();
assert!(match config.dac { assert!(match config.dac {
DacFamily::Etherdream(EtherDreamConf { ip }) if ip == "192.168.1.68" => true, DacFamily::Etherdream(EtherDreamConf { url }) if url == "192.168.1.68" => true,
_ => false, _ => false,
}); });
} }