Commit 9babc8d
committed
fix(st7789): fix backlight dimming accuracy and remove color/brightness bias
Original code expanded RGB565 to 8-bit channels, multiplied with truncating
division (/256), then shifted back — causing consistent darkening and minor
hue errors, especially noticeable at 40–80% brightness.
Improved version:
- Extracts components in native precision: 5-bit red/blue, 6-bit green
- Scales with proper rounding: (val * backlight + 127) >> 8
- Packs directly back to RGB565 format
Improves visual quality dramatically:
- Grays/whites stay neutral instead of going too dark or greenish
- Better preservation of shadow detail
- More natural fade-to-black behavior overall1 parent 56de0e8 commit 9babc8d
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
344 | 346 | | |
345 | 347 | | |
346 | 348 | | |
| |||
0 commit comments