format
Some checks failed
cargo_test_bench / Run Tests (push) Failing after 1m26s
cargo_test_bench / Run Benchmarks (push) Failing after 1m27s

This commit is contained in:
saji 2024-08-05 17:59:50 -05:00
parent c50f8cb955
commit 91be01196f
3 changed files with 10 additions and 13 deletions

View file

@ -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<dyn EInkPanel + Send> {
#[must_use]
#[instrument(skip_all)]
pub fn create_display_thread(
mut display: Box<dyn EInkPanel + Send>,
) -> (thread::JoinHandle<()>, mpsc::Sender<Box<DitheredImage>>) {
let mut display = get_display();
let (tx, rx) = mpsc::channel::<Box<DitheredImage>>();
let handle = thread::spawn(move || {
let span = span!(Level::INFO, "display_thread");

View file

@ -216,7 +216,10 @@ impl<'a> Ditherer for ErrorDiffusion<'a> {
let srgb = <&[Srgb<u8>]>::from_components(&**img);
let (xsize, ysize) = img.dimensions();
// our destination buffer.
let mut temp_img: Vec<Lab> = srgb.par_iter().map(|s| s.into_format().into_color()).collect();
let mut temp_img: Vec<Lab> = srgb
.par_iter()
.map(|s| s.into_format().into_color())
.collect();
let lab_palette: Vec<Lab> = output.palette.iter().map(|c| Lab::from_color(*c)).collect();
// TODO: rework this to make more sense.

View file

@ -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())
}