Add named logger
This commit is contained in:
parent
551b05e2f7
commit
2a10334edc
38 changed files with 286 additions and 208 deletions
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -134,10 +136,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1):
|
||||
epdconfig.delay_ms(20)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
|
|
@ -198,7 +200,7 @@ class EPD:
|
|||
return -1
|
||||
|
||||
if(isPartial):
|
||||
logging.debug("partial refresh")
|
||||
logger.debug("partial refresh")
|
||||
self.reset()
|
||||
self.ReadBusy()
|
||||
|
||||
|
|
@ -225,7 +227,7 @@ class EPD:
|
|||
self.ReadBusy()
|
||||
|
||||
else:
|
||||
logging.debug("full refresh")
|
||||
logger.debug("full refresh")
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
|
|
@ -273,14 +275,14 @@ class EPD:
|
|||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue