add suggested frame pacing
This commit is contained in:
parent
6a2ee5fcfa
commit
46c9174d3d
5 changed files with 21 additions and 16 deletions
|
@ -1,10 +1,11 @@
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use clap::Parser;
|
||||
use rand::{distributions, Rng};
|
||||
|
||||
use servicepoint2::{Command, CompressionCode, Connection, Origin, PixelGrid};
|
||||
use servicepoint2::{
|
||||
Command, CompressionCode, Connection, Origin, PixelGrid, FRAME_PACING,
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Cli {
|
||||
|
@ -32,7 +33,7 @@ fn main() {
|
|||
.into(),
|
||||
)
|
||||
.expect("could not send");
|
||||
thread::sleep(Duration::from_millis(30));
|
||||
thread::sleep(FRAME_PACING);
|
||||
field = iteration(field);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
use servicepoint2::{
|
||||
Command, CompressionCode, Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH,
|
||||
PixelGrid,
|
||||
Command, CompressionCode, Connection, Origin, PixelGrid, FRAME_PACING,
|
||||
PIXEL_HEIGHT, PIXEL_WIDTH,
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
|
@ -36,6 +35,6 @@ fn main() {
|
|||
.into(),
|
||||
)
|
||||
.unwrap();
|
||||
thread::sleep(Duration::from_millis(14));
|
||||
thread::sleep(FRAME_PACING);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ use std::time::Duration;
|
|||
use clap::Parser;
|
||||
use rand::Rng;
|
||||
|
||||
use servicepoint2::Command::{BitmapLinearWin, Brightness, CharBrightness};
|
||||
use servicepoint2::{
|
||||
ByteGrid, CompressionCode, Connection, Origin, PixelGrid, TILE_HEIGHT,
|
||||
TILE_WIDTH,
|
||||
};
|
||||
use servicepoint2::Command::{BitmapLinearWin, Brightness, CharBrightness};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Cli {
|
||||
|
@ -31,11 +31,8 @@ fn main() {
|
|||
let mut filled_grid = PixelGrid::max_sized();
|
||||
filled_grid.fill(true);
|
||||
|
||||
let command = BitmapLinearWin(
|
||||
Origin(0, 0),
|
||||
filled_grid,
|
||||
CompressionCode::Lzma,
|
||||
);
|
||||
let command =
|
||||
BitmapLinearWin(Origin(0, 0), filled_grid, CompressionCode::Lzma);
|
||||
connection.send(command.into()).expect("send failed");
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ use std::time::Duration;
|
|||
use clap::Parser;
|
||||
|
||||
use servicepoint2::{
|
||||
BitVec, Command, CompressionCode, Connection, PixelGrid, PIXEL_HEIGHT,
|
||||
PIXEL_WIDTH,
|
||||
BitVec, Command, CompressionCode, Connection, PixelGrid, FRAME_PACING,
|
||||
PIXEL_HEIGHT, PIXEL_WIDTH,
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
|
@ -19,7 +19,11 @@ struct Cli {
|
|||
fn main() {
|
||||
env_logger::init();
|
||||
let cli = Cli::parse();
|
||||
let sleep_duration = Duration::from_millis(cli.time / PIXEL_WIDTH as u64);
|
||||
|
||||
let sleep_duration = Duration::max(
|
||||
FRAME_PACING,
|
||||
Duration::from_millis(cli.time / PIXEL_WIDTH as u64),
|
||||
);
|
||||
|
||||
let connection = Connection::open(cli.destination).unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue