Code cleanup
This commit is contained in:
parent
684ab870e5
commit
7bc31cf587
12
display.py
12
display.py
|
@ -4,16 +4,16 @@ import os
|
||||||
import logging
|
import logging
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
libdir = "./lib/e-Paper/RaspberryPi_JetsonNano/python/lib"
|
libdir = "./e-Paper/RaspberryPi_JetsonNano/python/lib"
|
||||||
if os.path.exists(libdir):
|
if os.path.exists(libdir):
|
||||||
sys.path.append(libdir)
|
sys.path.append(libdir)
|
||||||
from waveshare_epd import epd7in5_V2 as epd7in5
|
from waveshare_epd import epd7in5_V2
|
||||||
|
|
||||||
# Ref https://github.com/waveshareteam/e-Paper/blob/master/RaspberryPi_JetsonNano/python/examples/epd_7in5_V2_test.py
|
# Ref https://github.com/waveshareteam/e-Paper/blob/master/RaspberryPi_JetsonNano/python/examples/epd_7in5_V2_test.py
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
epd = epd7in5.EPD()
|
epd = epd7in5_V2.EPD()
|
||||||
logging.debug("Initializing e-Paper display")
|
logging.debug("Initializing e-Paper display")
|
||||||
epd.init()
|
epd.init()
|
||||||
|
|
||||||
|
@ -26,12 +26,8 @@ def main():
|
||||||
epd.display(epd.getbuffer(Himage))
|
epd.display(epd.getbuffer(Himage))
|
||||||
|
|
||||||
# Put the display to sleep
|
# Put the display to sleep
|
||||||
epd.sleep()
|
|
||||||
logging.debug("Putting display to sleep")
|
logging.debug("Putting display to sleep")
|
||||||
|
epd.sleep()
|
||||||
# Clean up resources
|
|
||||||
epd.Dev_exit()
|
|
||||||
logging.debug("Exiting")
|
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logging.exception("IOError occurred: " + str(e))
|
logging.exception("IOError occurred: " + str(e))
|
||||||
|
|
Loading…
Reference in New Issue