reorder fields by importance
This commit is contained in:
parent
44fe6961e7
commit
5e38ced392
13 changed files with 21 additions and 28 deletions
|
|
@ -40,8 +40,8 @@ fn main() {
|
|||
|
||||
let text = cli.text.join("\n");
|
||||
let command = CharGridCommand {
|
||||
origin: Origin::ZERO,
|
||||
grid: CharGrid::wrap_str(TILE_WIDTH, &text),
|
||||
origin: Origin::ZERO,
|
||||
};
|
||||
connection.send(command).expect("sending text failed");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ fn main() {
|
|||
bitmap.fill(true);
|
||||
|
||||
let command = BitmapCommand {
|
||||
origin: Origin::ZERO,
|
||||
bitmap,
|
||||
origin: Origin::ZERO,
|
||||
compression: CompressionCode::default(),
|
||||
};
|
||||
connection.send(command).expect("send failed");
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ fn main() {
|
|||
|
||||
loop {
|
||||
let command = BitmapCommand {
|
||||
origin: Origin::ZERO,
|
||||
bitmap: field.clone(),
|
||||
origin: Origin::ZERO,
|
||||
compression: CompressionCode::default(),
|
||||
};
|
||||
connection.send(command).expect("could not send");
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ fn main() {
|
|||
filled_grid.fill(true);
|
||||
|
||||
let command = BitmapCommand {
|
||||
origin: Origin::ZERO,
|
||||
bitmap: filled_grid,
|
||||
origin: Origin::ZERO,
|
||||
compression: CompressionCode::default(),
|
||||
};
|
||||
connection.send(command).expect("send failed");
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ fn main() {
|
|||
pixels.fill(true);
|
||||
|
||||
let command = BitmapCommand {
|
||||
origin: Origin::ZERO,
|
||||
bitmap: pixels,
|
||||
origin: Origin::ZERO,
|
||||
compression: CompressionCode::default(),
|
||||
};
|
||||
connection.send(command).unwrap();
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ fn main() {
|
|||
}
|
||||
|
||||
let command = BitmapCommand {
|
||||
origin: Origin::ZERO,
|
||||
bitmap: enabled_pixels.clone(),
|
||||
origin: Origin::ZERO,
|
||||
compression: CompressionCode::default(),
|
||||
};
|
||||
connection
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ use crate::{
|
|||
/// ```
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct BitmapCommand {
|
||||
/// where to start drawing the pixels
|
||||
pub origin: Origin<Pixels>,
|
||||
/// the pixels to send
|
||||
pub bitmap: Bitmap,
|
||||
/// where to start drawing the pixels
|
||||
pub origin: Origin<Pixels>,
|
||||
/// how to compress the command when converting to packet
|
||||
pub compression: CompressionCode,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,10 @@ impl From<BitmapLegacyCommand> for TypedCommand {
|
|||
#[allow(deprecated)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::commands::tests::{round_trip, TestImplementsCommand};
|
||||
use crate::{Command, Header, TryIntoPacket};
|
||||
use crate::{
|
||||
commands::tests::{round_trip, TestImplementsCommand},
|
||||
Header
|
||||
};
|
||||
|
||||
impl TestImplementsCommand for BitmapLegacyCommand {}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ pub enum BinaryOperation {
|
|||
/// The contained [BitVec] is always uncompressed.
|
||||
#[derive(Clone, PartialEq, Debug, Eq)]
|
||||
pub struct BitVecCommand {
|
||||
/// where to start overwriting pixel data
|
||||
pub offset: Offset,
|
||||
/// the pixels to send to the display as one long row
|
||||
pub bitvec: BitVec,
|
||||
/// where to start overwriting pixel data
|
||||
pub offset: Offset,
|
||||
/// The operation to apply on the display per bit comparing old and new state.
|
||||
pub operation: BinaryOperation,
|
||||
/// how to compress the command when converting to packet
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ use crate::{
|
|||
/// Set the brightness of individual tiles in a rectangular area of the display.
|
||||
#[derive(Clone, PartialEq, Debug, Eq)]
|
||||
pub struct BrightnessGridCommand {
|
||||
/// which tile the brightness rectangle should start
|
||||
pub origin: Origin<Tiles>,
|
||||
/// the brightness values per tile
|
||||
pub grid: BrightnessGrid,
|
||||
/// which tile the brightness rectangle should start
|
||||
pub origin: Origin<Tiles>,
|
||||
}
|
||||
|
||||
impl TryFrom<BrightnessGridCommand> for Packet {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ use crate::{
|
|||
/// ```
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct CharGridCommand {
|
||||
/// which tile the text should start
|
||||
pub origin: Origin<Tiles>,
|
||||
/// the text to send to the display
|
||||
pub grid: CharGrid,
|
||||
/// which tile the text should start on
|
||||
pub origin: Origin<Tiles>,
|
||||
}
|
||||
|
||||
impl TryFrom<CharGridCommand> for Packet {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ use crate::{
|
|||
/// [CP-437]: https://en.wikipedia.org/wiki/Code_page_437
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Cp437GridCommand {
|
||||
/// which tile the text should start
|
||||
pub origin: Origin<Tiles>,
|
||||
/// the text to send to the display
|
||||
pub grid: Cp437Grid,
|
||||
/// which tile the text should start
|
||||
pub origin: Origin<Tiles>,
|
||||
}
|
||||
|
||||
impl TryFrom<Cp437GridCommand> for Packet {
|
||||
|
|
|
|||
|
|
@ -11,27 +11,18 @@ use crate::{
|
|||
/// Please look at the contained structs for documentation per command.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[allow(missing_docs)]
|
||||
#[allow(deprecated)]
|
||||
pub enum TypedCommand {
|
||||
Clear(ClearCommand),
|
||||
|
||||
CharGrid(CharGridCommand),
|
||||
|
||||
Cp437Grid(Cp437GridCommand),
|
||||
|
||||
Bitmap(BitmapCommand),
|
||||
|
||||
Brightness(BrightnessCommand),
|
||||
|
||||
BrightnessGrid(BrightnessGridCommand),
|
||||
|
||||
BitVec(BitVecCommand),
|
||||
|
||||
HardReset(HardResetCommand),
|
||||
|
||||
FadeOut(FadeOutCommand),
|
||||
|
||||
#[deprecated]
|
||||
#[allow(deprecated)]
|
||||
BitmapLegacy(crate::BitmapLegacyCommand),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue