WLED
WLED copied to clipboard
Fix for displaying 1bpp bmp files (usermod EleksTube IPS)
When working with a 1 bit per pixel bmp file, this forces the color palette to zero and something other than zero (tried 255 and it worked for me). Before this fix, the monochrome bmp would display fine in the file manager but would display all black on the ips screen.
@blazoncek could you also take a look at the "legacy" code of this usermod? Especially the line below is a bit unusual - is it OK that usermods call strip.service() directly?
https://github.com/dvdavide/WLED/blob/dc2cfee75754b0ec6e071355ed51905606fa8227/usermods/EleksTube_IPS/TFTs.h#L78
if (!realtimeMode || realtimeOverride || (realtimeMode && useMainSegmentOnly)) strip.service();
Same concerns for the usermod loop(), which directly fiddles around with segment data structure, I'm wondering if that's the correct way to handle segments...
Unfortunately I never used EleksTube so know nothing of it.
As far as I am concerned every usermod is an optional thing so, apart from excessive RAM or flash use, I am relatively ok with whatever contributors provide.
Calling strip.service()
is a bit unusual though.
Perhaps @Aircoookie knows more.
strip.service()
is called periodically, because reading the BMP and drawing it to the screen is slow and blocks for too long, thus causing low framerates in effects.
Not a fan of hardcoding 255, since this will discard the color value saved in the bitmap palette. Will need to give it a try later. @dvdavide would you provide an example 1bpp bitmap for testing? It might be that your image editor handles BMP palettes differently from paint.NET.
You can find an example of the fonts I use at https://github.com/dvdavide/Elekstube-fonts I converted them in ms paint (windows 11), and as i said they show up fine in the wled file manager preview, but the tft display shows black, and not stuck on last picture as when a file is missing/unreadable.