IniterWorker / gc9a01

GC9A01 Display Driver
Apache License 2.0
16 stars 7 forks source link

OutOfBoundsError when drawing shapes with embedded_graphics #11

Closed TravisThomp closed 3 weeks ago

TravisThomp commented 3 weeks ago

I'm using a raspberry pi zero-2w and the rppal bindings.

My setup is

let interface = SPIDisplayInterface::new(spi_device, dc);
let display = Gc9a01::new(interface, DisplayResolution240x240, self.rotation).into_buffered_graphics();

When I draw with display.set_pixel(...) it works perfectly, but when I attempt to use embedded_graphics to draw a simple rectangle(or any shape)

let thin_stroke = PrimitiveStyle::with_fill(Rgb565::GREEN);
match Rectangle::new(Point::new(16, 16), Size::new(20, 20)).into_styled(thin_stroke).draw(&mut self.display)
{
    Ok(_) => println!("Drew it!"),
    Err(e) => println!("Failed to draw rectangle: {:?}", e),
}
self.display.flush()?;

I get this error Failed to draw rectangle: OutOfBoundsError

I've seen only code that works based off lvgl but I'm not in need of UI. Is there something I'm missing to get this to work with just embedded_graphics?

IniterWorker commented 3 weeks ago

Thanks for reporting the regression. I believe that the changes in commit 37445e33 should resolve the issue.

Please test it and let me know if this solves the issue, or if there are any further problems.

IniterWorker commented 3 weeks ago

Fixed on 0.4.2. the version 0.4.1 is yanked. Feel free to reopen if the problem still exists.

TravisThomp commented 3 weeks ago

Works like a charm, thank you! :)