Update
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
use std::{io, sync::{Arc, Mutex}, thread, time::{Duration, Instant}};
|
||||
use std::{
|
||||
io,
|
||||
sync::{Arc, Mutex},
|
||||
thread,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use serialport::SerialPort;
|
||||
@@ -11,7 +16,9 @@ enum MCUResponse {
|
||||
Sync,
|
||||
Ack,
|
||||
#[allow(dead_code)]
|
||||
Info { num_pkts: u32 },
|
||||
Info {
|
||||
num_pkts: u32,
|
||||
},
|
||||
}
|
||||
|
||||
fn poll_response(ser: &mut dyn SerialPort) -> Result<MCUResponse> {
|
||||
@@ -38,9 +45,12 @@ fn poll_response(ser: &mut dyn SerialPort) -> Result<MCUResponse> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn controller_thread(running: Arc<Mutex<bool>>, movingheads: Arc<Mutex<[MovingHead; 4]>>) -> Result<()> {
|
||||
pub fn controller_thread(
|
||||
running: Arc<Mutex<bool>>,
|
||||
movingheads: Arc<Mutex<[MovingHead; 4]>>,
|
||||
) -> Result<()> {
|
||||
let frame_time = Duration::from_secs_f64(1.0 / FPS as f64);
|
||||
|
||||
|
||||
let mut dmx_buffer = [0u8; 512];
|
||||
|
||||
let mut ser = serialport::new("/dev/ttyUSB0", 500_000)
|
||||
|
||||
Reference in New Issue
Block a user