cargo fmt; clippy fix

This commit is contained in:
saji 2024-07-27 23:06:23 -05:00
parent fa367e6436
commit 7e5d13849e
3 changed files with 9 additions and 10 deletions

View file

@ -3,10 +3,10 @@ use axum::extract::Multipart;
use axum::http::StatusCode; use axum::http::StatusCode;
use axum::response::IntoResponse; use axum::response::IntoResponse;
use axum::{extract::State, response::Response, routing::post, Router}; use axum::{extract::State, response::Response, routing::post, Router};
use image::{ImageReader, RgbImage}; use image::ImageReader;
use std::io::Cursor; use std::io::Cursor;
use std::time::Duration; use std::time::Duration;
use tracing::{error, info, debug, instrument}; use tracing::{debug, error, info, instrument};
use crate::display::EInkPanel; use crate::display::EInkPanel;
use std::sync::Arc; use std::sync::Arc;
@ -36,7 +36,6 @@ impl Context {
} }
} }
#[derive(Debug)] #[derive(Debug)]
pub struct DisplaySetCommand { pub struct DisplaySetCommand {
img: Box<EInkImage>, img: Box<EInkImage>,
@ -107,10 +106,10 @@ async fn set_image(
let mut buf = EInkImage::new(800, 480); let mut buf = EInkImage::new(800, 480);
let dither = ErrorDiffusionDither::new(DiffusionMatrix::Atkinson); let dither = ErrorDiffusionDither::new(DiffusionMatrix::Atkinson);
dither.dither(&image.into(), &mut buf); dither.dither(&image.into(), &mut buf);
let cmd = DisplaySetCommand { let cmd = DisplaySetCommand { img: Box::new(buf) };
img: Box::new(buf), ctx.display_channel
}; .send_timeout(cmd, Duration::from_secs(10))
ctx.display_channel.send_timeout(cmd, Duration::from_secs(10)).await?; .await?;
} }
} }
Ok(()) Ok(())

View file

@ -3,7 +3,7 @@ use linux_embedded_hal::spidev::SpiModeFlags;
use linux_embedded_hal::spidev::SpidevOptions; use linux_embedded_hal::spidev::SpidevOptions;
use linux_embedded_hal::{CdevPin, Delay, SpidevDevice}; use linux_embedded_hal::{CdevPin, Delay, SpidevDevice};
use tracing::instrument; use tracing::instrument;
use tracing::{debug, debug_span, warn}; use tracing::{debug, warn};
use anyhow::Result; use anyhow::Result;
use linux_embedded_hal::gpio_cdev::{Chip, LineRequestFlags}; use linux_embedded_hal::gpio_cdev::{Chip, LineRequestFlags};

View file

@ -3,11 +3,11 @@ pub mod display;
pub mod errors; pub mod errors;
pub mod imageproc; pub mod imageproc;
use crate::display::{EInkPanel, FakeEInk, Wrapper}; use crate::display::{EInkPanel, Wrapper};
use crate::imageproc::{DiffusionMatrix, Ditherer, EInkImage, ErrorDiffusionDither}; use crate::imageproc::{DiffusionMatrix, Ditherer, EInkImage, ErrorDiffusionDither};
use tracing::info;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use image::RgbImage; use image::RgbImage;
use tracing::info;
/// Display images over /// Display images over
#[derive(Debug, Parser)] #[derive(Debug, Parser)]