update to servicepoint2 v0.4.0
This commit is contained in:
parent
e5c6734339
commit
3578a279c5
5 changed files with 31 additions and 30 deletions
|
@ -23,7 +23,7 @@ pub(crate) fn execute_command(
|
|||
warn!("display shutting down");
|
||||
return false;
|
||||
}
|
||||
Command::BitmapLinearWin(Origin(x, y), pixels) => {
|
||||
Command::BitmapLinearWin(Origin(x, y), pixels, _) => {
|
||||
let mut display = display_ref.write().unwrap();
|
||||
print_pixel_grid(x as usize, y as usize, &pixels, &mut display);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::sync::mpsc::Sender;
|
|||
use std::sync::RwLock;
|
||||
|
||||
use log::{info, warn};
|
||||
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
|
||||
use pixels::wgpu::TextureFormat;
|
||||
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
|
||||
use servicepoint2::{
|
||||
ByteGrid, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, TILE_SIZE,
|
||||
ByteGrid, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_SIZE,
|
||||
};
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::dpi::{LogicalSize, Size};
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -8,7 +8,7 @@ use std::time::Duration;
|
|||
use clap::Parser;
|
||||
use log::{info, warn};
|
||||
use servicepoint2::{
|
||||
ByteGrid, Command, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_HEIGHT,
|
||||
ByteGrid, Command, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, TILE_HEIGHT,
|
||||
TILE_WIDTH,
|
||||
};
|
||||
use winit::event_loop::{ControlFlow, EventLoop};
|
||||
|
@ -102,8 +102,13 @@ fn run(
|
|||
);
|
||||
}
|
||||
|
||||
let vec = buf[..amount].to_vec();
|
||||
let package = servicepoint2::Packet::from(vec);
|
||||
let package = match servicepoint2::Packet::try_from(&buf[..amount]) {
|
||||
Err(_) => {
|
||||
warn!("could not load packet with length {amount} into header");
|
||||
continue;
|
||||
}
|
||||
Ok(package) => package,
|
||||
};
|
||||
|
||||
let command = match Command::try_from(package) {
|
||||
Err(err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue