Add named logger

This commit is contained in:
missionfloyd 2021-08-01 17:52:15 -06:00 committed by GitHub
parent 551b05e2f7
commit 2a10334edc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 286 additions and 208 deletions

View file

@ -35,6 +35,8 @@ from . import epdconfig
EPD_WIDTH = 640
EPD_HEIGHT = 384
logger = logging.getLogger(__name__)
class EPD:
def __init__(self):
self.reset_pin = epdconfig.RST_PIN
@ -72,10 +74,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) == 0): # 0: idle, 1: busy
epdconfig.delay_ms(100)
logging.debug("e-Paper busy release")
logger.debug("e-Paper busy release")
def init(self):
if (epdconfig.module_init() != 0):
@ -134,7 +136,7 @@ class EPD:
img = img.rotate(90, expand=True).convert('1')
imwidth, imheight = img.size
else:
logging.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
# return a blank buffer
return buf