diff --git a/src/display.rs b/src/display.rs index 0546688..89be090 100644 --- a/src/display.rs +++ b/src/display.rs @@ -51,11 +51,7 @@ impl Wrapper { let mut delay = Delay {}; let panel = Epd7in3f::new(&mut spi, busy_pin, dc_pin, rst_pin, &mut delay, None)?; - Ok(Self { - spi, - delay, - panel, - }) + Ok(Self { spi, delay, panel }) } pub fn test(&mut self) -> Result<()> { self.panel.show_7block(&mut self.spi, &mut self.delay)?; @@ -109,8 +105,8 @@ pub fn get_display() -> Box { #[must_use] #[instrument(skip_all)] pub fn create_display_thread( - mut display: Box, ) -> (thread::JoinHandle<()>, mpsc::Sender>) { + let mut display = get_display(); let (tx, rx) = mpsc::channel::>(); let handle = thread::spawn(move || { let span = span!(Level::INFO, "display_thread"); diff --git a/src/dither.rs b/src/dither.rs index 37c91c2..4e881a8 100644 --- a/src/dither.rs +++ b/src/dither.rs @@ -216,7 +216,10 @@ impl<'a> Ditherer for ErrorDiffusion<'a> { let srgb = <&[Srgb]>::from_components(&**img); let (xsize, ysize) = img.dimensions(); // our destination buffer. - let mut temp_img: Vec = srgb.par_iter().map(|s| s.into_format().into_color()).collect(); + let mut temp_img: Vec = srgb + .par_iter() + .map(|s| s.into_format().into_color()) + .collect(); let lab_palette: Vec = output.palette.iter().map(|c| Lab::from_color(*c)).collect(); // TODO: rework this to make more sense. diff --git a/src/eink.rs b/src/eink.rs index fbaa1d8..db00c41 100644 --- a/src/eink.rs +++ b/src/eink.rs @@ -16,8 +16,6 @@ const DISPLAY_PALETTE: [Srgb; 7] = [ Srgb::new(0.757, 0.443, 0.165), // Orange ]; - - /// A more primitive palette that doesn't reflect reality. Here for posterity. /// This is based on the datasheet, not on empirical testing const SIMPLE_PALETTE: [Srgb; 7] = [ @@ -30,7 +28,9 @@ const SIMPLE_PALETTE: [Srgb; 7] = [ Srgb::new(0.757, 0.443, 0.165), // Orange ]; -#[derive(strum::EnumString, strum::Display, Serialize, Deserialize, PartialEq, Eq, Debug, Clone, Copy)] +#[derive( + strum::EnumString, strum::Display, Serialize, Deserialize, PartialEq, Eq, Debug, Clone, Copy, +)] pub enum Palette { Default, Simple, @@ -46,11 +46,9 @@ impl Palette { } } - - /// Construct a dithered image for the EINK display using the default palette and correct /// resolution. #[must_use] pub fn new_image() -> DitheredImage { - DitheredImage::new(800,480, DISPLAY_PALETTE.to_vec()) + DitheredImage::new(800, 480, DISPLAY_PALETTE.to_vec()) }