russhughes / st7789py_mpy

Driver for 320x240, 240x240, 135x240 and 128x128 ST7789 displays written in MicroPython
MIT License
159 stars 59 forks source link

Update image_converter.rgb_to_color565 to make converted colors more accurate. #14

Open echo-lalia opened 5 months ago

echo-lalia commented 5 months ago

Hello! I noticed while working on a project, and using your display driver, that the original rgb_to_color565 code seems to output some inaccurate colors.

This is easy to test by passing (255, 255, 255), which should become 0xffff, but instead becomes 0xfff8.
I've replaced it with some code that outputs 0xffff, and otherwise just outputs more accurate colors.

The main st7789py.py file still uses the other implementation, but I was hesitant to change it because I haven't tested to see if there's a speed difference, or anything like that.