Try to debug hi.qoi

This commit is contained in:
Sofia 2025-09-12 14:23:14 +03:00
parent 7225591e7d
commit b31d6255bf
2 changed files with 4 additions and 3 deletions

Binary file not shown.

View File

@ -14,7 +14,7 @@ use crate::{
}; };
// https://qoiformat.org/qoi-specification.pdf // https://qoiformat.org/qoi-specification.pdf
const image: &[u8; 852] = include_bytes!("../images/sheep.qoi"); const image: &[u8; 1253] = include_bytes!("../images/hi.qoi");
const BUFFER_SIZE: usize = 64; const BUFFER_SIZE: usize = 64;
#[derive(Debug, uDebug)] #[derive(Debug, uDebug)]
@ -73,7 +73,6 @@ pub fn draw_image<T: DelayNs, DCPin: PinOps, RSTPin: PinOps>(
// colors[i * 2 + 1] = c2; // colors[i * 2 + 1] = c2;
// } // }
// display.write(Writeable::Data(&colors)); // display.write(Writeable::Data(&colors));
// display.delay.delay_ms(100);
// } // }
let mut counter = 0u32; let mut counter = 0u32;
for pixel in qoi_iter { for pixel in qoi_iter {
@ -118,7 +117,7 @@ impl<'a> QoiIterator<'a> {
QoiIterator { QoiIterator {
inner: bytes, inner: bytes,
serial, serial,
prev_pixels: [Rgb565(255, 255, 255); 64], prev_pixels: [Rgb565(0, 255, 0); 64],
prev_alphas: [255; 64], prev_alphas: [255; 64],
last_pixel: Rgb565(0, 0, 0), last_pixel: Rgb565(0, 0, 0),
last_alpha: 255, last_alpha: 255,
@ -134,6 +133,7 @@ impl<'a> Iterator for QoiIterator<'a> {
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
if self.parsed_colors >= self.expected_colors { if self.parsed_colors >= self.expected_colors {
ufmt::uwriteln!(self.serial, "Reached expected").unwrap();
return None; return None;
} }
self.parsed_colors += 1; self.parsed_colors += 1;
@ -245,6 +245,7 @@ impl<'a> Iterator for QoiIterator<'a> {
self.prev_pixels[hash] = color; self.prev_pixels[hash] = color;
Some(color) Some(color)
} else { } else {
ufmt::uwriteln!(self.serial, "End reached").unwrap();
None None
} }
} }