Skip to content

Commit

Permalink
fix(waveshare): keep display for clear method
Browse files Browse the repository at this point in the history
  • Loading branch information
loiccoyle committed Jul 1, 2024
1 parent 00363ad commit cb508ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
13 changes: 11 additions & 2 deletions tinyticker/waveshare_lib/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,16 @@ def display(self, image: bytearray) -> None:
"""
...

def getbuffer(self, image: Image.Image) -> bytearray:
@abstractmethod
def display_grayscale(self, image: bytearray) -> None:
"""Display the grayscale image buffer on the e-paper display.
Args:
image: The grayscale image data to display.
"""
...

def getbuffer_grayscale(self, image: Image.Image) -> bytearray:
if (self.height, self.width) == image.size:
# image has correct dimensions, but needs to be rotated
image = image.rotate(90, expand=True)
Expand Down Expand Up @@ -212,7 +221,7 @@ def clear(self) -> None:
self.display(self._blank)

def show(self, image: Image.Image) -> None:
self.display(self.getbuffer(image))
self.display_grayscale(self.getbuffer_grayscale(image))


# Could be used later to utilize the partial refresh feature of some of the EPDs
Expand Down
12 changes: 6 additions & 6 deletions tinyticker/waveshare_lib/epd2in7.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,13 @@ def Init_4Gray(self):
self.send_command(0x50) # VCOM AND DATA INTERVAL SETTING
self.send_data(0x57)

# def display(self, image):
# self.send_command(0x13)
# self.send_data2(image)
# self.send_command(0x12)
# self.ReadBusy()

def display(self, image):
self.send_command(0x13)
self.send_data2(image)
self.send_command(0x12)
self.ReadBusy()

def display_grayscale(self, image):
self.send_command(0x10)
for i in range(0, 5808): # 5808*4 46464
temp3 = 0
Expand Down
10 changes: 5 additions & 5 deletions tinyticker/waveshare_lib/epd2in7_V2.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ def Init_4Gray(self):
self.send_data(0x00)
self.ReadBusy()

# def display(self, image):
# self.send_command(0x24)
# self.send_data2(image)
# self.TurnOnDisplay()
def display(self, image):
self.send_command(0x24)
self.send_data2(image)
self.TurnOnDisplay()

def display_Fast(self, image):
self.send_command(0x24)
Expand Down Expand Up @@ -437,7 +437,7 @@ def display_Partial(self, Image, Xstart, Ystart, Xend, Yend):
self.send_data(Image[i + j * Width])
self.TurnOnDisplay_Partial()

def display(self, image):
def display_grayscale(self, image):
self.send_command(0x24)
for i in range(0, 5808): # 5808*4 46464
temp3 = 0
Expand Down

0 comments on commit cb508ab

Please sign in to comment.