fix blinking

This commit is contained in:
jane 2021-12-28 19:51:04 -05:00
parent f72ad4b616
commit 879648edc3

View file

@ -7,7 +7,7 @@ use rs_ws281x::{RawColor, Controller, ControllerBuilder, ChannelBuilder, StripTy
use std::{thread, time};
pub const LED_SIZE: usize = 450; //450
pub const BRIGHTNESS: u8 = 150;
pub const BRIGHTNESS: u8 = 100;
pub const LOOP_WAIT: u64 = 250;
fn main() {
@ -35,7 +35,7 @@ fn main() {
//pattern parsing
let mul_string = format_multiline(concat!(
"val 0 0 255\n",
"val 0 0 0\n",
"val r 255"
));
let res: Result<Vec<Box<dyn Pattern>>, ParseError> = mul_string.iter()
@ -51,9 +51,11 @@ fn main() {
//pattern management
loop {
thread::sleep(time::Duration::from_millis(LOOP_WAIT));
for p in &pattern {
let c_lock = Arc::clone(&lock);
let mut lights = c_lock.write().unwrap();
for p in &pattern {
//let c_lock = Arc::clone(&lock);
//let mut lights = c_lock.write().unwrap();
p.execute(&mut lights);
}
}