diff --git a/aura/examples/animatrix.rs b/aura/examples/animatrix.rs index f8fbcac9..4d82a491 100644 --- a/aura/examples/animatrix.rs +++ b/aura/examples/animatrix.rs @@ -1,13 +1,18 @@ use rog_aura::AnimatrixDbusWriter; -fn main() -> Result<(), Box> { - let mut writer = AnimatrixDbusWriter::new()?; +const PANE1_PREFIX: [u8; 7] = [0x5e, 0xc0, 0x02, 0x01, 0x00, 0x73, 0x02]; +const PANE2_PREFIX: [u8; 7] = [0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x02]; - let mut send_buffer = [vec![0; 640], vec![0; 640]]; +fn main() { + let mut writer = AnimatrixDbusWriter::new().unwrap(); loop { - writer.write_image(&send_buffer)?; + for brightness in 0..0xFF { + let mut buffers = [vec![brightness; 640], vec![brightness; 640]]; + buffers[0][..7].copy_from_slice(&PANE1_PREFIX); + buffers[0][..7].copy_from_slice(&PANE2_PREFIX); - //std::thread::sleep(std::time::Duration::from_millis(60)); + writer.write_image(&buffers).unwrap(); + } } } diff --git a/aura/src/animatrix_dbus.rs b/aura/src/animatrix_dbus.rs index c8ab8f67..850a2c57 100644 --- a/aura/src/animatrix_dbus.rs +++ b/aura/src/animatrix_dbus.rs @@ -21,7 +21,7 @@ impl AnimatrixDbusWriter { let connection = Connection::new_system()?; Ok(AnimatrixDbusWriter { connection: Box::new(connection), - block_time: 100, + block_time: 25, stop: Arc::new(AtomicBool::new(false)), }) }