diff --git a/src/lib.rs b/src/lib.rs index e0ba226..0aff6eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,6 +33,9 @@ pub struct Layout { pub num_panels_h: u32, pub num_panels_v: u32, + + pub total_strands: u32, + pub first_strand_index: u32, } impl Layout { diff --git a/src/main.rs b/src/main.rs index 3319d61..f6daa5e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -154,6 +154,9 @@ fn main() -> anyhow::Result<()> { num_panels_h: 6, num_panels_v: 1, + + total_strands: 24, + first_strand_index: 8, }; match args.action { diff --git a/src/sender.rs b/src/sender.rs index 3dcb9ea..1010d23 100644 --- a/src/sender.rs +++ b/src/sender.rs @@ -64,9 +64,21 @@ pub fn send_frame( frame_num: u32, image: &RgbImage, ) -> Result<(), SenderError> { - for strand_num in 0..layout.num_strands() { - let data = Strandifier::make_strand(layout, image, strand_num)?; - send_strand(socket, strand_num, frame_num, data)?; + for strand_num in 0..layout.total_strands { + if strand_num >= layout.first_strand_index + && strand_num < layout.num_strands() + layout.first_strand_index + { + let data = + Strandifier::make_strand(layout, image, strand_num - layout.first_strand_index)?; + send_strand(socket, strand_num as u32, frame_num, data)?; + } else { + send_strand( + socket, + strand_num as u32, + frame_num, + vec![Rgb([0, 0, 0]); layout.strand_len() as usize], + )?; + } } let mut buf = vec![0; 100];