Merge pull request #280 from txoof/standardize

Standardize library modules
This commit is contained in:
Wilson 2023-02-16 15:16:55 +08:00 committed by GitHub
commit bb184dbc64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 14 additions and 14 deletions

View File

@ -23,7 +23,7 @@ try:
'''2Gray(Black and white) display'''
logging.info("init and Clear")
epd.init()
epd.clear()
epd.Clear()
font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
font35 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 35)
@ -145,7 +145,7 @@ try:
time.sleep(2)
logging.info("Clear...")
epd.clear()
epd.Clear()
logging.info("Goto Sleep...")
epd.sleep()

View File

@ -236,7 +236,7 @@ class EPD:
self.send_data(image[i + j * int(self.width / 8)])
self.TurnOnDisplay()
def Clear(self, color):
def Clear(self, color=0xFF):
# self.SetWindow(0, 0, self.width - 1, self.height - 1)
# send the color data
self.SetWindow(0, 0, self.width, self.height)

View File

@ -244,7 +244,7 @@ class EPD:
self.set_lut(self.WF_Full_1IN54) # Set lut
def Clear(self, color):
def Clear(self, color=0xFF):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:

View File

@ -201,7 +201,7 @@ class EPD:
self.send_data(image[i + j * linewidth])
self.TurnOnDisplay()
def Clear(self, color):
def Clear(self, color=0xFF):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:

View File

@ -280,7 +280,7 @@ class EPD:
self.send_data2(image)
self.TurnOnDisplay()
def Clear(self, color):
def Clear(self, color=0xFF):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:

View File

@ -361,7 +361,7 @@ class EPD:
function : Clear screen
parameter:
'''
def Clear(self, color):
def Clear(self, color=0xFF):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:

View File

@ -324,7 +324,7 @@ class EPD:
buf[int((newx + (newy * self.width))/4)] = ((pixels[x, y-3]&0xc0) | (pixels[x, y-2]&0xc0)>>2 | (pixels[x, y-1]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)
return buf
def clear(self):
def Clear(self):
if(self.width % 8 == 0):
Width = self.width // 8
else:

View File

@ -185,7 +185,7 @@ class EPD:
self.send_data(image[i + j * int(self.width / 8)])
self.TurnOnDisplay()
def Clear(self, color):
def Clear(self, color=0xFF):
self.SetWindow(0, 0, self.width - 1, self.height - 1)
for j in range(0, self.height):
self.SetCursor(0, j)

View File

@ -285,7 +285,7 @@ class EPD:
self.send_data2(image)
self.TurnOnDisplay_Partial()
def Clear(self, color):
def Clear(self, color=0xFF):
if self.width%8 == 0:
linewidth = int(self.width/8)
else:

View File

@ -32,8 +32,8 @@ from multiprocessing.reduction import recv_handle
from . import epdconfig
# Display resolution
EPD_width = 240
EPD_height = 360
EPD_WIDTH = 240
EPD_HEIGHT = 360
logger = logging.getLogger(__name__)
@ -43,8 +43,8 @@ class EPD:
self.dc_pin = epdconfig.DC_PIN
self.busy_pin = epdconfig.BUSY_PIN
self.cs_pin = epdconfig.CS_PIN
self.width = EPD_width
self.height = EPD_height
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
self.Flag = 0
self.WHITE = 0xFF
self.BLACK = 0x00