-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdisplay.py
More file actions
41 lines (34 loc) · 858 Bytes
/
display.py
File metadata and controls
41 lines (34 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Modules
import logging
import os
import sys
# Functions and variables
from var import show_display
from waveshare_epd import epd3in7
epd = epd3in7.EPD()
def check_display():
if show_display == True:
logging.info("Display is enabled.")
logging.debug("epd3in7")
else:
logging.info("Display is disabled.")
def initialize():
if show_display == True:
try:
logging.info("Starting display init")
epd.init(0)
except IOError as e:
logging.error(e)
def display_overlay(overlay_img):
if show_display == True:
epd.display_1Gray(epd.getbuffer(overlay_img))
def display_screen(screen_img):
if show_display == True:
epd.display_4Gray(epd.getbuffer_4Gray(screen_img))
def shutdown():
if show_display == True:
logging.info("Shutting down screen")
epd.init(0)
epd.Clear(0xFF, 0)
epd3in7.epdconfig.module_exit(cleanup=True)
exit()