Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
a45abd69ec |
@ -62,8 +62,15 @@ impl EtherdreamDevice {
|
||||
}
|
||||
Ok((dac, source_addr)) => {
|
||||
info!("Valid broadcast, source_addr: {}", source_addr);
|
||||
if source_addr.is_ipv6() { return None; }
|
||||
if &source_addr.ip().to_string() != ip { return None; }
|
||||
if source_addr.is_ipv6() {
|
||||
warn!("Broadcast ignored: ipv6 address.");
|
||||
return None;
|
||||
}
|
||||
let src_ip = source_addr.ip().to_string();
|
||||
if &src_ip != ip {
|
||||
warn!("Broadcast ignored: expected {ip}, got: {src_ip} ");
|
||||
return None;
|
||||
}
|
||||
Some(Ok((dac, source_addr)))
|
||||
}
|
||||
}
|
||||
@ -168,11 +175,11 @@ impl Device for EtherdreamDevice {
|
||||
debug!("New chunk length: {:?}", chunk.len());
|
||||
loop {
|
||||
let capacity = self.points_capacity();
|
||||
if chunk.len() > capacity as usize {
|
||||
if chunk.len() > capacity {
|
||||
debug!("Sleep, capacity : {:?}", capacity);
|
||||
// Sleep for 1/100th of a sec
|
||||
sleep(Duration::new( 0, 10000000));
|
||||
self.ping();
|
||||
self.ping()?;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -181,9 +188,9 @@ impl Device for EtherdreamDevice {
|
||||
match self.stream
|
||||
.queue_commands()
|
||||
.data(
|
||||
chunk.into_iter()
|
||||
chunk.iter()
|
||||
.map(|point| (*point).into())
|
||||
.take(chunk_size as usize)
|
||||
.take(chunk_size)
|
||||
)
|
||||
.submit() {
|
||||
Err(err) => {
|
||||
@ -233,8 +240,8 @@ impl Device for EtherdreamDevice {
|
||||
}
|
||||
|
||||
fn grid(&mut self) -> Vec<Point> {
|
||||
let dim_mid = 16000 as f32;
|
||||
let dim_max = 32000 as f32;
|
||||
let dim_mid = 16000.0;
|
||||
let dim_max = 32000.0;
|
||||
let col_min = Color { r: 0, g: 0, b: 0 };
|
||||
let col_max = Color { r: 255, g: 255, b: 255 };
|
||||
|
||||
@ -275,10 +282,10 @@ impl Iterator for SineWave {
|
||||
let amp = (hz * (fract + phase) * 2.0 * std::f32::consts::PI).sin();
|
||||
let (r, g, b) = match i {
|
||||
i if i == coloured_points_per_frame || i < 13 => (0, 0, 0),
|
||||
_ => (std::u16::MAX, std::u16::MAX, std::u16::MAX),
|
||||
_ => (u16::MAX, u16::MAX, u16::MAX),
|
||||
};
|
||||
let x_min = std::i16::MIN;
|
||||
let x_max = std::i16::MAX;
|
||||
let x_min = i16::MIN;
|
||||
let x_max = i16::MAX;
|
||||
let x = (x_min as f32 + fract * (x_max as f32 - x_min as f32)) as i16;
|
||||
let y = (amp * x_max as f32) as i16;
|
||||
let control = 0;
|
||||
@ -298,4 +305,4 @@ impl Iterator for SineWave {
|
||||
self.point += 1;
|
||||
Some(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ impl Device for HeliosDevice {
|
||||
|
||||
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 dim_mid = 2047.0;
|
||||
let dim_max = 4095.0;
|
||||
let col_min = Color { r: 0, g: 0, b: 0 };
|
||||
let col_max = Color { r: 255, g: 255, b: 255 };
|
||||
|
||||
|
@ -76,7 +76,7 @@ fn run_all() -> LJResult<()> {
|
||||
// Dispatch based on redis requests
|
||||
while running.load(Ordering::SeqCst) {
|
||||
rs.set_status(tracer.status())?;
|
||||
let _ = framerate_handler.handle_time()?;
|
||||
framerate_handler.handle_time()?;
|
||||
let order = rs.get_order(config.laser_id)?;
|
||||
match order {
|
||||
Order::Draw | Order::Black | Order::Grid => {
|
||||
|
@ -98,10 +98,10 @@ impl RedisCtrl {
|
||||
|
||||
pub fn init_world_state(&mut self) -> LJResult<WorldState> {
|
||||
Ok(WorldState {
|
||||
client_key: self.get_client_key().unwrap(),
|
||||
edh: self.get_edh().unwrap(),
|
||||
kpps: self.get_int("kpps").unwrap().try_into().unwrap(),
|
||||
intensity: self.get_int("intensity").unwrap().try_into().unwrap(),
|
||||
client_key: self.get_client_key()?,
|
||||
edh: self.get_edh()?,
|
||||
kpps: self.get_int("kpps")?.try_into()?,
|
||||
intensity: self.get_int("intensity")?.try_into()?,
|
||||
..WorldState::default()
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user