Click here to Skip to main content
16,018,525 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: .NET Core & (auto)binding: Is it a bug? Pin
raddevus16-Jun-24 6:52
mvaraddevus16-Jun-24 6:52 
GeneralRe: .NET Core & (auto)binding: Is it a bug? Pin
Richard Deeming16-Jun-24 21:52
mveRichard Deeming16-Jun-24 21:52 
GeneralRe: .NET Core & (auto)binding: Is it a bug? Pin
raddevus17-Jun-24 2:10
mvaraddevus17-Jun-24 2:10 
GeneralRe: .NET Core & (auto)binding: Is it a bug? Pin
jochance18-Jun-24 3:05
jochance18-Jun-24 3:05 
GeneralUntested Backups with IonicZip Pin
kmoorevs2-Jun-24 5:30
kmoorevs2-Jun-24 5:30 
GeneralRe: Untested Backups with IonicZip Pin
MarkTJohnson4-Jun-24 5:19
professionalMarkTJohnson4-Jun-24 5:19 
GeneralRe: Untested Backups with IonicZip Pin
kmoorevs4-Jun-24 6:49
kmoorevs4-Jun-24 6:49 
GeneralLooking at the very topmost line ... Pin
trønderen1-Jun-24 11:21
trønderen1-Jun-24 11:21 
GeneralRe: Looking at the very topmost line ... Pin
Greg Utas1-Jun-24 16:42
professionalGreg Utas1-Jun-24 16:42 
GeneralRe: Looking at the very topmost line ... Pin
Daniel Pfeffer1-Jun-24 19:57
professionalDaniel Pfeffer1-Jun-24 19:57 
GeneralRe: Looking at the very topmost line ... Pin
TNCaver4-Jun-24 5:58
TNCaver4-Jun-24 5:58 
GeneralRe: Looking at the very topmost line ... Pin
trønderen4-Jun-24 14:37
trønderen4-Jun-24 14:37 
GeneralRe: Looking at the very topmost line ... Pin
Daniel Pfeffer4-Jun-24 20:19
professionalDaniel Pfeffer4-Jun-24 20:19 
GeneralRe: Looking at the very topmost line ... Pin
trønderen5-Jun-24 3:21
trønderen5-Jun-24 3:21 
GeneralRe: Looking at the very topmost line ... Pin
Daniel Pfeffer5-Jun-24 8:29
professionalDaniel Pfeffer5-Jun-24 8:29 
GeneralRe: Looking at the very topmost line ... Pin
jochance6-Jun-24 6:31
jochance6-Jun-24 6:31 
GeneralRe: Looking at the very topmost line ... Pin
Richard Andrew x6416-Jun-24 8:12
professionalRichard Andrew x6416-Jun-24 8:12 
GeneralBlessed endian mismatches collide with progress Pin
honey the codewitch1-Jun-24 7:30
mvahoney the codewitch1-Jun-24 7:30 
Almost all embedded MCUs are little endian.
Almost all display controllers that can connect to them are big endian.

My graphics library builds pixels in big endian order on little endian machines as a consequence. It's just more efficient.

LVGL is another embedded graphics library - one I contribute to - and they removed a feature on version 9+ where you could set it to swap the bytes on a 16 bit color value. This is to compensate for the endian issues.

Not swapping during the draw operation means you need to scan and rearrange the transfer buffer before you send it to the display.

C++
evoid lcd_flush_display( lv_display_t *disp, const lv_area_t *area, uint8_t * px_map) {
    size_t count = (area->x2-area->x1+1)*(area->y2-area->y1+1);
    for(int i = 0;i<count;++i) {
        uint16_t* p = &((uint16_t*)px_map)[i];
        *p = ((*p<<8)&0xFF00)|((*p>>8)&0xFF);
    }
    esp_lcd_panel_draw_bitmap(lcd_handle,area->x1,area->y1,area->x2+1,area->y2+1,px_map);
    LV_UNUSED(disp);
}


This is less efficient. It's also ugly. This is what's for dinner now in LVGL. This is "progress".

The worst part is I understand and even sort of agree with why they did it.

The issue is multiple displays, and the fact that some displays may not need the swap, perhaps because they're monochrome or something. Previously prior to 8 LVGL simply didn't support that scenario because the swap option was a #define (LVGL is C, not C++) and it applied to all displays as a consequence.

But to remove it entirely seems like it was a decision guided by expediency more than anything. It's unfortunate.

And all of it reminds me of why I hate the fact that humans couldn't universally agree on endian order.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix


modified 1-Jun-24 13:36pm.

GeneralRe: Blessed endian mismatches collide with progress Pin
Ron Anders1-Jun-24 8:26
Ron Anders1-Jun-24 8:26 
JokeRe: Blessed endian mismatches collide with progress Pin
PIEBALDconsult1-Jun-24 9:22
mvePIEBALDconsult1-Jun-24 9:22 
GeneralRe: Blessed endian mismatches collide with progress Pin
trønderen1-Jun-24 11:13
trønderen1-Jun-24 11:13 
GeneralRe: Blessed endian mismatches collide with progress Pin
honey the codewitch1-Jun-24 11:33
mvahoney the codewitch1-Jun-24 11:33 
GeneralRe: Blessed endian mismatches collide with progress Pin
trønderen1-Jun-24 12:39
trønderen1-Jun-24 12:39 
GeneralRe: Blessed endian mismatches collide with progress Pin
honey the codewitch1-Jun-24 12:47
mvahoney the codewitch1-Jun-24 12:47 
GeneralRe: Blessed endian mismatches collide with progress Pin
trønderen2-Jun-24 4:32
trønderen2-Jun-24 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.