adafruit / Adafruit_CircuitPython_RGB_Display

Drivers for RGB displays for Adafruit CircuitPython.
MIT License
129 stars 52 forks source link

catch only the r/g/b values when list is longer #119

Closed reza-n closed 4 months ago

reza-n commented 6 months ago

fixing an issue when 4 values are returned instead of r/g/b. Might be safer to always truncate the list to 3. Similar to issue #117

(0, 0, 0, 0)
Traceback (most recent call last):
  File "/var/local/pproxy/git/home_device/usr/local/pproxy/tests/lcd_test.py", line 23, in <module>
    LCD.show_logo()
  File "/var/local/pproxy/git/home_device/usr/local/pproxy/tests/../lcd.py", line 284, in show_logo
    self.lcd.image(image, x, y)
  File "/var/local/pproxy/wepn-env/lib/python3.9/site-packages/adafruit_rgb_display/rgb.py", line 231, in image
    pix = color565(img.getpixel((i, j)))
  File "/var/local/pproxy/wepn-env/lib/python3.9/site-packages/adafruit_rgb_display/rgb.py", line 59, in color565
    red, g, b = r
ValueError: too many values to unpack (expected 3)