Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd7in3f.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Somebody has colour problems with the 13,3inch Spektra 6 Panel, too? I dont get the Panel running in colour with the existing drivers :-(

Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ def init(self):
return 0

def getbuffer(self, image):
# Create a pallette with the 7 colors supported by the panel
# Create a palette with the 6 colors supported by the E6/Spectra 6 panel
# Black, White, Yellow, Red, Blue, Green (NO orange - hardware doesn't support it)
pal_image = Image.new("P", (1,1))
pal_image.putpalette( (0,0,0, 255,255,255, 0,255,0, 0,0,255, 255,0,0, 255,255,0, 255,128,0) + (0,0,0)*249)
pal_image.putpalette( (0,0,0, 255,255,255, 255,255,0, 255,0,0, 0,0,255, 0,255,0) + (0,0,0)*250)

# Check if we need to rotate the image
imwidth, imheight = image.size
Expand All @@ -211,16 +212,16 @@ def getbuffer(self, image):
else:
logger.warning("Invalid image dimensions: %d x %d, expected %d x %d" % (imwidth, imheight, self.width, self.height))

# Convert the soruce image to the 7 colors, dithering if needed
image_7color = image_temp.convert("RGB").quantize(palette=pal_image)
buf_7color = bytearray(image_7color.tobytes('raw'))
# Convert the source image to the 6 colors, dithering if needed
image_6color = image_temp.convert("RGB").quantize(palette=pal_image)
buf_6color = bytearray(image_6color.tobytes('raw'))

# PIL does not support 4 bit color, so pack the 4 bits of color
# into a single byte to transfer to the panel
buf = [0x00] * int(self.width * self.height / 2)
idx = 0
for i in range(0, len(buf_7color), 2):
buf[idx] = (buf_7color[i] << 4) + buf_7color[i+1]
for i in range(0, len(buf_6color), 2):
buf[idx] = (buf_6color[i] << 4) + buf_6color[i+1]
idx += 1

return buf
Expand All @@ -244,4 +245,3 @@ def sleep(self):
epdconfig.delay_ms(2000)
epdconfig.module_exit()
### END OF FILE ###