diff --git a/src/main.rs b/src/main.rs index c1dac899433039de335ac97875811ddba959a359..57ad2b5745b9e1faea000147d9d9f221074ab6e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,15 @@ use anyhow::bail; use image::{GenericImageView, ImageReader}; -const TOAST_TIME_SECONDS: u64 = 60; +const TOAST_TIME_SECONDS: u64 = 15; const CENTER_X: f64 = 100.0; const CENTER_Y: f64 = 100.0; -const BREAD_HEIGHT: f64 = 15.3; -const IDLE_HEIGHT: f64 = BREAD_HEIGHT + 10.0; -const PIXEL_SIZE_MM: f64 = 4.0; +const BREAD_HEIGHT: f64 = 12.0; +const IDLE_HEIGHT: f64 = BREAD_HEIGHT + 5.0; +const PIXEL_SIZE_MM: f64 = 3.0; fn main() -> anyhow::Result<()> { - let img = ImageReader::open("/home/stephen/Downloads/qr_tiny.png")?.decode()?; + let img = ImageReader::open("/home/stephen/Downloads/scd31-qr.png")?.decode()?; preamble(); @@ -19,14 +19,14 @@ fn main() -> anyhow::Result<()> { match p.0 { [0, 0, 0, 255] => { - // nothing, for now - } - [255, 255, 255, 255] => { toast( x as f64 - (img.width() as f64 / 2.0), y as f64 - (img.height() as f64 / 2.0), ); } + [255, 255, 255, 255] => { + // white + } _ => bail!("Pixel was not entirely black nor entirely white: {:?}", p), } } @@ -42,7 +42,7 @@ G28 ; home G90 ; absolute positioning G0 Z{IDLE_HEIGHT} G0 X{CENTER_X} Y{CENTER_Y} -M109 S220 ; heat hotend to 220C and wait +M109 S230 ; heat hotend to 230C and wait "# ); }