fix on 38 displays

This commit is contained in:
Jeroen Oudshoorn
2024-02-15 20:46:48 +01:00
parent 0999b95be0
commit eb48d29851
38 changed files with 94 additions and 65 deletions

View File

@ -12,6 +12,7 @@ from . import config
from . import LCD_1in44
from PIL import ImageOps
class EPD(object):
def __init__(self):
self.width = 128
@ -24,9 +25,8 @@ class EPD(object):
pass
def clear(self):
#self.LCD.LCD_Clear()
pass
self.LCD.LCD_Clear()
def display(self, image):
rgb_im = ImageOps.colorize(image.convert("L"), black ="green", white ="black")
rgb_im = ImageOps.colorize(image.convert("L"), black="green", white="black")
self.LCD.LCD_ShowImage(rgb_im, 0, 0)

View File

@ -38,7 +38,8 @@ class Waveshare13in3k(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare1in02(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -39,7 +39,7 @@ class Waveshare154(DisplayImpl):
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
self._display.display(buf)
def clear(self):
# pass

View File

@ -39,7 +39,7 @@ class Waveshare154V2(DisplayImpl):
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare1in54c(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare1in64g(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare2in36g(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -34,11 +34,12 @@ class Waveshare2in66(DisplayImpl):
logging.info("initializing waveshare 2.66 inch lcd display")
from pwnagotchi.ui.hw.libs.waveshare.v2in66.epd2in66 import EPD
self._display = EPD()
self._display.init(0)
self._display.init(1)
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare2in66g(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -39,7 +39,7 @@ class Waveshare27b(DisplayImpl):
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf)
self._display.display(buf, None)
def clear(self):
self._display.Clear(0xff)

View File

@ -39,7 +39,7 @@ class Waveshare27bV2(DisplayImpl):
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf)
self._display.display(buf, None)
def clear(self):
self._display.Clear(0xff)

View File

@ -35,12 +35,12 @@ class Waveshare29bV3(DisplayImpl):
from pwnagotchi.ui.hw.libs.waveshare.v2in9b_v3.epd2in9b_V3 import EPD
self._display = EPD()
self._display.init()
self._display.Clear(0xFF)
self._display.Clear()
self._display.init()
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf)
self._display.display(buf, None)
def clear(self):
self._display.Clear(0xFF)
self._display.Clear()

View File

@ -35,12 +35,12 @@ class Waveshare29bV4(DisplayImpl):
from pwnagotchi.ui.hw.libs.waveshare.v2in9b_v4.epd2in9b_V4 import EPD
self._display = EPD()
self._display.init()
self._display.Clear(0xFF)
self._display.Clear()
self._display.init()
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display(buf)
self._display.display(buf, None)
def clear(self):
self._display.Clear(0xFF)
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare2in9bc(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare2in9d(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -10,8 +10,8 @@ class Waveshare3in0g(DisplayImpl):
def layout(self):
fonts.setup(10, 8, 10, 18, 25, 9)
self._layout['width'] = 400
self._layout['height'] = 168
self._layout['width'] = 168
self._layout['height'] = 400
self._layout['face'] = (0, 43)
self._layout['name'] = (0, 14)
self._layout['channel'] = (0, 0)
@ -38,7 +38,8 @@ class Waveshare3in0g(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -9,24 +9,24 @@ class Waveshare3in7(DisplayImpl):
super(Waveshare3in7, self).__init__(config, 'waveshare3in7')
def layout(self):
fonts.setup(20, 19, 20, 45, 35, 19)
self._layout['width'] = 480
self._layout['height'] = 280
self._layout['face'] = (0, 75)
self._layout['name'] = (5, 35)
fonts.setup(10, 8, 10, 18, 25, 9)
self._layout['width'] = 280
self._layout['height'] = 480
self._layout['face'] = (0, 43)
self._layout['name'] = (0, 14)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (65, 0)
self._layout['uptime'] = (355, 0)
self._layout['line1'] = [0, 25, 480, 25]
self._layout['line2'] = [0, 255, 480, 255]
self._layout['friend_face'] = (0, 146)
self._layout['friend_name'] = (40, 146)
self._layout['shakes'] = (0, 258)
self._layout['mode'] = (430, 258)
self._layout['aps'] = (0, 71)
self._layout['uptime'] = (0, 25)
self._layout['line1'] = [0, 12, 280, 12]
self._layout['line2'] = [0, 116, 280, 116]
self._layout['friend_face'] = (12, 88)
self._layout['friend_name'] = (1, 103)
self._layout['shakes'] = (26, 117)
self._layout['mode'] = (0, 117)
self._layout['status'] = {
'pos': (225, 35),
'font': fonts.status_font(fonts.Medium),
'max': 21
'pos': (65, 26),
'font': fonts.status_font(fonts.Small),
'max': 12
}
return self._layout
@ -35,12 +35,11 @@ class Waveshare3in7(DisplayImpl):
from pwnagotchi.ui.hw.libs.waveshare.v3in7.epd3in7 import EPD
self._display = EPD()
self._display.init(0)
self._display.Clear(0xFF)
self._display.init(1) # 1Gray mode
self._display.Clear(0)
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display_1Gray(buf)
self._display.display(buf)
def clear(self):
self._display.Clear(0)

View File

@ -38,7 +38,8 @@ class Waveshare4in01f(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare4in2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare4in26(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare4in2V2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare4in2bV2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare4in2bc(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare4in37g(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare5in65f(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare5in83(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare5in83V2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare5in83bV2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare5in83bc(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in3f(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in3g(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in5(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in5HD(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -51,7 +51,8 @@ class Waveshare7in5V2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in5bHD(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in5bV2(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()

View File

@ -38,7 +38,8 @@ class Waveshare7in5bc(DisplayImpl):
self._display.Clear()
def render(self, canvas):
self._display.display(canvas)
buf = self._display.getbuffer(canvas)
self._display.display(buf, None)
def clear(self):
self._display.Clear()