feat: allow specifying strand subset
This commit is contained in:
parent
031245496e
commit
0d8f11c712
3 changed files with 21 additions and 3 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue