Support grayscale displays #716
Replies: 12 comments
-
@TomSaw is our display expert now, his #665 is addressing some of these issues. |
Beta Was this translation helpful? Give feedback.
-
Yepp I've also had my concerns with the display implementations in the beginning of this year. However, not all cases where multiple pixels are stuffed into one byte are covered yet:
I've added this to the TODOs of #665 and also should have some SSD1322 around so I can test it. Being on a journey until next week but I'll implement this as next. Stay tuned! |
Beta Was this translation helpful? Give feedback.
-
This is awesome and I'm glad to hear you're considering multi-pixel-per-byte cases. There's one extra complication with SSD1322 that you need to be aware of: addressing is per word, not per byte. So a single 16-bit cell in memory represents four 4-bit pixels - this affects the widths of partial drawing sprites. Did you consider extending support to drawing just parts of the display? This speeds up most of the use cases a lot. In my own project I easily hit north of 100 FPS (that's where my counter ends) even with a very inefficient SPI driver. No wonder why - each frame was sending just a handful of bytes. Added benefit is that you don't need much RAM - you can drive a large OLED with something as small as atmega8. |
Beta Was this translation helpful? Give feedback.
-
Spend some time today on the generic colors / buffers and will add some self-explaining examples for the new APIs to #665 as soon as the generic colors and buffers are good enough... ... In short, this is the new workflow:1. Declare your color-type
2. Declare your buffer-typeWhen using
3. Draw and write into the buffer (similar like before)
4. Finally send the buffer to a display with optional position. When the buffer overflows the display, it's clipped. Therefore you can move buffers around on the display to create nice animations.
|
Beta Was this translation helpful? Give feedback.
-
This is awesome, exactly (or more than) what I expected from embedded display library. In my own personal project I did one more thing with buffers and embedded images. Writable |
Beta Was this translation helpful? Give feedback.
-
Hey twasilczyk, sry for my late answer. I'm running too much projects X-) Please check #665 -> Support for more colormodelsTo support more than monochrome images, the header - of course - has to be extended with some signature for the colormodel. I didn't even review the conversion-script that makes *.hpp and *.css out of *.pbm. Would love to fix that as well but my priority is on finishing these generic colors and followup 💥 Would be awesome, if you could spend some time on the converter to support more colormodels and png! Do you want to? |
Beta Was this translation helpful? Give feedback.
-
PS: I can't wait getting back to my project(s) and enjoy the fruits of this "little subproject" of a rewrite 🥳. |
Beta Was this translation helpful? Give feedback.
-
I can’t promise anything, since modm image APIs are just a prerequisite to a side project (Smart Response XE BSP) to my other hobby project that I temporarily gave a break :D. Having said that, a converter script with png and multi-color mode support shouldn’t be far from what I currently have. I’ll try to give it a shot. |
Beta Was this translation helpful? Give feedback.
-
No problem, just had the feeling you're willing to bring yourself in. |
Beta Was this translation helpful? Give feedback.
-
#665 now supports stacked monochrome, gray1, gray2 and gray4 Buffers. I have slept a night over the ST7586 pixel-format you've mentioned in #673 - where one byte just contains 3 2bit-pixels - and came out with this: Facts
Outcome
Please check From my side, issue can be closed. |
Beta Was this translation helpful? Give feedback.
-
In general, I agree, but there's one important counter-point: in its current form, pixel conversion from monochrome to st7586s monochrome format takes 3x more time than transmission itself (checked with logic analyzer, but I don't remember exact numbers), what brings FPS down significantly. If the implementation supported both Gray2 and Gray332 formats, one could pick former for fast buffer manipulation and the latter for fast drawing directly from flash. Having said that, I'm happy with the performance with on-the-fly conversion. For closing this (or any other) issue, I would wait for merging the PR. Up to you. |
Beta Was this translation helpful? Give feedback.
-
I see your point: There's nothing that restricts you from storing your image in whatever colorformat in flash and copy it byte by byte. It's mainly the Display drivers business who takes a #665 concentrates on the fundamental architecture and of course port existing features. Thus i've just migrated the good old monochrome What's left to make Gray332-image flash->display work:
If you're in a hurry, you may implement 1. and 2. 🙄 somehow and we'll migrate everything later!? You may boost The Gray2222 -> Gray332 conversion by a factor using a LUT.. This converts 12 pixels within a handful of ticks. Costs you 64bytes for the LUT but spares 1/4 of your flash used for images. Here's a sketch of a the whole algorithm: True, issue is not solved. Let's wait for #665 and keep it until things run as expected. |
Beta Was this translation helpful? Give feedback.
-
modm::ui::display either supports monochrome or color displays. The two displays I've been working with (SSD1322 and ST7586S) are 16- and 4-level grayscale.
One option would be to make ColorGraphicDisplay a template allowing other color profiles than Rgb565; then add 16/4 level color profile. Then maybe even MonochromeGraphicDisplay could just use the same template with 1-bit color profile. There's a challenge though: in 16-level grayscale displays, two pixels are encoded in a single byte.
While we're at modm::ui::display, there's also one benefit of using these controllers that modm doesn't utilize: you can select a fragment of the display and not update the whole thing.
Beta Was this translation helpful? Give feedback.
All reactions