mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-18 10:30:14 +01:00
update shared lib
This commit is contained in:
parent
63520f5708
commit
88409faa02
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2151,7 +2151,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servicepoint2"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/kaesaecracker/servicepoint.git#06d3a99659dc32060c7a302fa8d7147c5227dda6"
|
||||
source = "git+https://github.com/kaesaecracker/servicepoint.git#9eaa7462bccee02f698779b0fb4b9c1e9676bc60"
|
||||
dependencies = [
|
||||
"num",
|
||||
"num-derive",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use servicepoint2::DisplayCommandCode;
|
||||
use servicepoint2::CommandCode;
|
||||
use std::mem::size_of;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct HdrWindow {
|
||||
pub command: DisplayCommandCode,
|
||||
pub command: CommandCode,
|
||||
pub x: u16,
|
||||
pub y: u16,
|
||||
pub w: u16,
|
||||
|
@ -36,7 +36,7 @@ pub enum DisplaySubcommand {
|
|||
#[derive(Debug)]
|
||||
pub enum ReadHeaderError {
|
||||
BufferTooSmall,
|
||||
WrongCommandEndianness(u16, DisplayCommandCode),
|
||||
WrongCommandEndianness(u16, CommandCode),
|
||||
InvalidCommand(u16),
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ impl HdrWindow {
|
|||
}
|
||||
|
||||
let command_u16 = Self::read_beu16(&buffer[0..=1]);
|
||||
return match DisplayCommandCode::from_primitive(command_u16) {
|
||||
return match CommandCode::from_primitive(command_u16) {
|
||||
Some(command) => Ok(HdrWindow {
|
||||
command,
|
||||
x: Self::read_beu16(&buffer[2..=3]),
|
||||
|
@ -58,8 +58,7 @@ impl HdrWindow {
|
|||
h: Self::read_beu16(&buffer[8..=9]),
|
||||
}),
|
||||
None => {
|
||||
let maybe_command =
|
||||
DisplayCommandCode::from_primitive(u16::swap_bytes(command_u16));
|
||||
let maybe_command = CommandCode::from_primitive(u16::swap_bytes(command_u16));
|
||||
return match maybe_command {
|
||||
None => Err(ReadHeaderError::InvalidCommand(command_u16)),
|
||||
Some(command) => Err(ReadHeaderError::WrongCommandEndianness(
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::font::BitmapFont;
|
|||
use crate::protocol::{HdrWindow, ReadHeaderError};
|
||||
use crate::DISPLAY;
|
||||
use log::{debug, error, info, warn};
|
||||
use servicepoint2::{PixelGrid, PIXEL_WIDTH, TILE_SIZE, DisplayCommandCode};
|
||||
use servicepoint2::{PixelGrid, PIXEL_WIDTH, TILE_SIZE, CommandCode};
|
||||
use std::io::ErrorKind;
|
||||
use std::net::{ToSocketAddrs, UdpSocket};
|
||||
use std::sync::mpsc;
|
||||
|
@ -88,20 +88,20 @@ impl UdpThread {
|
|||
);
|
||||
|
||||
match header.command {
|
||||
DisplayCommandCode::Clear => {
|
||||
CommandCode::Clear => {
|
||||
info!("clearing display");
|
||||
for v in unsafe { DISPLAY.iter_mut() } {
|
||||
*v = false;
|
||||
}
|
||||
}
|
||||
DisplayCommandCode::HardReset => {
|
||||
CommandCode::HardReset => {
|
||||
warn!("display shutting down");
|
||||
return;
|
||||
}
|
||||
DisplayCommandCode::BitmapLinearWin => {
|
||||
CommandCode::BitmapLinearWin => {
|
||||
Self::print_bitmap_linear_win(&header, payload);
|
||||
}
|
||||
DisplayCommandCode::Cp437data => {
|
||||
CommandCode::Cp437Data => {
|
||||
Self::print_cp437_data(&header, payload, font);
|
||||
}
|
||||
_ => {
|
||||
|
|
Loading…
Reference in a new issue