mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 10:00:14 +01:00
examples: error message on connection failure
This commit is contained in:
parent
7200cb3247
commit
e1f009ee6f
|
@ -22,9 +22,11 @@ fn main() {
|
||||||
cli.text.push("Hello, CCCB!".to_string());
|
cli.text.push("Hello, CCCB!".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let connection = Connection::open(&cli.destination).unwrap();
|
let connection = Connection::open(&cli.destination)
|
||||||
|
.expect("could not connect to display");
|
||||||
|
|
||||||
if cli.clear {
|
if cli.clear {
|
||||||
connection.send(Command::Clear).unwrap();
|
connection.send(Command::Clear).expect("sending clear failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
let max_width = cli.text.iter().map(|t| t.len()).max().unwrap();
|
let max_width = cli.text.iter().map(|t| t.len()).max().unwrap();
|
||||||
|
@ -41,5 +43,5 @@ fn main() {
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.send(Command::Cp437Data(Origin(0, 0), chars))
|
.send(Command::Cp437Data(Origin(0, 0), chars))
|
||||||
.unwrap();
|
.expect("sending text failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ struct Cli {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let connection = Connection::open(cli.destination).unwrap();
|
let connection = Connection::open(cli.destination)
|
||||||
|
.expect("could not connect to display");
|
||||||
|
|
||||||
let mut pixels = PixelGrid::max_sized();
|
let mut pixels = PixelGrid::max_sized();
|
||||||
pixels.fill(true);
|
pixels.fill(true);
|
||||||
|
|
|
@ -18,7 +18,8 @@ struct Cli {
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let connection = Connection::open(&cli.destination).unwrap();
|
let connection = Connection::open(&cli.destination)
|
||||||
|
.expect("could not connect to display");
|
||||||
let mut field = make_random_field(cli.probability);
|
let mut field = make_random_field(cli.probability);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
|
@ -13,7 +13,8 @@ struct Cli {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let connection = Connection::open(Cli::parse().destination).unwrap();
|
let connection = Connection::open(Cli::parse().destination)
|
||||||
|
.expect("could not connect to display");
|
||||||
|
|
||||||
let mut pixels = PixelGrid::max_sized();
|
let mut pixels = PixelGrid::max_sized();
|
||||||
for x_offset in 0..usize::MAX {
|
for x_offset in 0..usize::MAX {
|
||||||
|
|
|
@ -22,7 +22,8 @@ struct Cli {
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let connection = Connection::open(cli.destination).unwrap();
|
let connection = Connection::open(cli.destination)
|
||||||
|
.expect("could not connect to display");
|
||||||
let wait_duration = Duration::from_millis(cli.wait_ms);
|
let wait_duration = Duration::from_millis(cli.wait_ms);
|
||||||
|
|
||||||
// put all pixels in on state
|
// put all pixels in on state
|
||||||
|
|
|
@ -22,7 +22,8 @@ fn main() {
|
||||||
Duration::from_millis(cli.time / PIXEL_WIDTH as u64),
|
Duration::from_millis(cli.time / PIXEL_WIDTH as u64),
|
||||||
);
|
);
|
||||||
|
|
||||||
let connection = Connection::open(cli.destination).unwrap();
|
let connection = Connection::open(cli.destination)
|
||||||
|
.expect("could not connect to display");
|
||||||
|
|
||||||
let mut enabled_pixels = PixelGrid::new(PIXEL_WIDTH, PIXEL_HEIGHT);
|
let mut enabled_pixels = PixelGrid::new(PIXEL_WIDTH, PIXEL_HEIGHT);
|
||||||
enabled_pixels.fill(true);
|
enabled_pixels.fill(true);
|
||||||
|
@ -38,7 +39,7 @@ fn main() {
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma))
|
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma))
|
||||||
.unwrap();
|
.expect("could not send command to display");
|
||||||
thread::sleep(sleep_duration);
|
thread::sleep(sleep_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue