42 lines
897 B
Python
42 lines
897 B
Python
|
#!/usr/bin/python
|
||
|
# -*- coding:utf-8 -*-
|
||
|
import sys
|
||
|
import os
|
||
|
|
||
|
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'frontend/lib')
|
||
|
|
||
|
if os.path.exists(libdir):
|
||
|
sys.path.append(libdir)
|
||
|
|
||
|
import logging
|
||
|
from waveshare_epd import epd7in5_V2
|
||
|
import time
|
||
|
from PIL import Image
|
||
|
import traceback
|
||
|
|
||
|
logging.basicConfig(level=logging.DEBUG)
|
||
|
|
||
|
try:
|
||
|
logging.info("Updating Alba screen...")
|
||
|
epd = epd7in5_V2.EPD()
|
||
|
|
||
|
logging.info("Init and clear...")
|
||
|
epd.init()
|
||
|
epd.Clear()
|
||
|
|
||
|
logging.info("Read the BMP file...")
|
||
|
Himage = Image.open('/home/andrea/src/alba/frontend/screen.bmp')
|
||
|
epd.display(epd.getbuffer(Himage))
|
||
|
time.sleep(2)
|
||
|
|
||
|
logging.info("Go to sleep...")
|
||
|
epd.sleep()
|
||
|
|
||
|
except IOError as e:
|
||
|
logging.info(e)
|
||
|
|
||
|
except KeyboardInterrupt:
|
||
|
logging.info("ctrl + c:")
|
||
|
epd7in5_V2.epdconfig.module_exit()
|
||
|
exit()
|