fix compression, rename enum values

This commit is contained in:
Vinzenz Schroeter 2024-05-16 21:32:33 +02:00
parent 7b6b4ea806
commit 6834bb084b
10 changed files with 119 additions and 123 deletions

View file

@ -25,7 +25,7 @@ fn main() {
connection
.send(Command::BitmapLinearWin(Origin::top_left(), field.clone()).into())
.expect("could not send");
thread::sleep(Duration::from_millis(14));
thread::sleep(Duration::from_millis(30));
field = iteration(field);
}
}

View file

@ -3,9 +3,7 @@ use std::time::Duration;
use clap::Parser;
use servicepoint2::{
BitVec, Command, CompressionCode, Connection, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid
};
use servicepoint2::{BitVec, Command, CompressionCode, Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid};
#[derive(Parser, Debug)]
struct Cli {
@ -20,6 +18,12 @@ fn main() {
let cli = Cli::parse();
let connection = Connection::open(cli.destination).unwrap();
let mut buf = PixelGrid::max_sized();
buf.fill(true);
connection.send(Command::BitmapLinearWin(Origin(0, 0), buf).into())
.expect("send failed");
let sleep_duration = Duration::from_millis(cli.time / PIXEL_WIDTH as u64);
let mut enabled_pixels =
@ -36,7 +40,7 @@ fn main() {
let bit_vec = BitVec::from(&*pixel_data);
connection
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Gz).into())
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma).into())
.unwrap();
thread::sleep(sleep_duration);
}