-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When rotating displays dimensions are not getting updated #104
Comments
Example of how another https://github.com/jamwaffles/ssd1306/blob/master/src/lib.rs#L279 ...and: https://github.com/jamwaffles/ssd1306/blob/master/src/mode/buffered_graphics.rs#L237 |
…d) when rotating displays 90 and 270 degrees.
Yep just wanted to create this exact same issue.. and found this one.. :) Fixed it for my display as follows: (and works fine now with 'embedded graphics' and 'embedded layout') impl OriginDimensions for Display2in13 {
fn size(&self) -> Size {
match self.rotation() {
DisplayRotation::Rotate0 | DisplayRotation::Rotate180 => Size::new(WIDTH, HEIGHT),
DisplayRotation::Rotate90 | DisplayRotation::Rotate270 => Size::new(HEIGHT, WIDTH),
}
}
}
Ps. I see there's quite some code duplication in this library, also the screen/controller code is not very well separated either. I'd say some major (probably API-breaking) refactoring are in order.. (maybe even an name change, as this is really not about supporting Waveshare EPD's only..) |
CAme here for the same thing! |
If you call
display.set_rotation(DisplayRotation::Rotate90);
ordisplay.set_rotation(DisplayRotation::Rotate270);
the display's dimensions (WIDTH/HEIGHT) should be swapped so thatembedded-graphics
text alignment features can work properly. As things are right now, if you rotate the display 90° or 270° only left-aligned text will display properly.The text was updated successfully, but these errors were encountered: