Got display working
This commit is contained in:
parent
8f9a7de613
commit
dc98fd122d
@ -25,6 +25,9 @@ if [ "$?" != "0" ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Running updates, this might take a few minutes..."
|
||||||
|
pikvm-update
|
||||||
|
|
||||||
# Fix banner
|
# Fix banner
|
||||||
echo ""
|
echo ""
|
||||||
echo "Updating the banner..."
|
echo "Updating the banner..."
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
0
lib/waveshare_epd/__init__.py
Normal file
0
lib/waveshare_epd/__init__.py
Normal file
BIN
lib/waveshare_epd/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
lib/waveshare_epd/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
lib/waveshare_epd/__pycache__/epd2in13_V4.cpython-312.pyc
Normal file
BIN
lib/waveshare_epd/__pycache__/epd2in13_V4.cpython-312.pyc
Normal file
Binary file not shown.
BIN
lib/waveshare_epd/__pycache__/epdconfig.cpython-312.pyc
Normal file
BIN
lib/waveshare_epd/__pycache__/epdconfig.cpython-312.pyc
Normal file
Binary file not shown.
@ -45,6 +45,7 @@ class EPD:
|
|||||||
self.cs_pin = epdconfig.CS_PIN
|
self.cs_pin = epdconfig.CS_PIN
|
||||||
self.width = EPD_WIDTH
|
self.width = EPD_WIDTH
|
||||||
self.height = EPD_HEIGHT
|
self.height = EPD_HEIGHT
|
||||||
|
print('init complete')
|
||||||
|
|
||||||
'''
|
'''
|
||||||
function :Hardware reset
|
function :Hardware reset
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
|
|
||||||
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
|
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
|
||||||
|
|
||||||
if os.path.exists(libdir):
|
if os.path.exists(libdir):
|
||||||
sys.path.append(libdir)
|
sys.path.append(libdir)
|
||||||
|
|
||||||
@ -21,12 +22,14 @@ try:
|
|||||||
epd = epd2in13_V4.EPD()
|
epd = epd2in13_V4.EPD()
|
||||||
logging.info("init and Clear")
|
logging.info("init and Clear")
|
||||||
epd.init()
|
epd.init()
|
||||||
|
|
||||||
epd.Clear(0xFF)
|
epd.Clear(0xFF)
|
||||||
|
|
||||||
# Drawing on the image
|
# Drawing on the image
|
||||||
font15 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 15)
|
print(os.path.join(libdir, 'Font.ttc'))
|
||||||
font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
|
font15 = ImageFont.truetype(os.path.join(libdir, 'Font.ttc'), 15)
|
||||||
|
font24 = ImageFont.truetype(os.path.join(libdir, 'Font.ttc'), 24)
|
||||||
|
print('fonts done')
|
||||||
if 1:
|
if 1:
|
||||||
logging.info("E-paper refresh")
|
logging.info("E-paper refresh")
|
||||||
epd.init()
|
epd.init()
|
||||||
@ -51,7 +54,7 @@ try:
|
|||||||
|
|
||||||
# read bmp file
|
# read bmp file
|
||||||
logging.info("2.read bmp file...")
|
logging.info("2.read bmp file...")
|
||||||
image = Image.open(os.path.join(picdir, '2in13.bmp'))
|
image = Image.open(os.path.join(libdir, '2in13.bmp'))
|
||||||
epd.display(epd.getbuffer(image))
|
epd.display(epd.getbuffer(image))
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@ -59,7 +62,7 @@ try:
|
|||||||
logging.info("3.read bmp file on window...")
|
logging.info("3.read bmp file on window...")
|
||||||
# epd.Clear(0xFF)
|
# epd.Clear(0xFF)
|
||||||
image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||||
bmp = Image.open(os.path.join(picdir, '100x100.bmp'))
|
bmp = Image.open(os.path.join(libdir, '100x100.bmp'))
|
||||||
image1.paste(bmp, (2,2))
|
image1.paste(bmp, (2,2))
|
||||||
epd.display(epd.getbuffer(image1))
|
epd.display(epd.getbuffer(image1))
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@ -89,7 +92,7 @@ try:
|
|||||||
|
|
||||||
# read bmp file
|
# read bmp file
|
||||||
logging.info("2.read bmp file...")
|
logging.info("2.read bmp file...")
|
||||||
image = Image.open(os.path.join(picdir, '2in13.bmp'))
|
image = Image.open(os.path.join(libdir, '2in13.bmp'))
|
||||||
epd.display_fast(epd.getbuffer(image))
|
epd.display_fast(epd.getbuffer(image))
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@ -97,7 +100,7 @@ try:
|
|||||||
logging.info("3.read bmp file on window...")
|
logging.info("3.read bmp file on window...")
|
||||||
# epd.Clear(0xFF)
|
# epd.Clear(0xFF)
|
||||||
image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||||
bmp = Image.open(os.path.join(picdir, '100x100.bmp'))
|
bmp = Image.open(os.path.join(libdir, '100x100.bmp'))
|
||||||
image1.paste(bmp, (2,2))
|
image1.paste(bmp, (2,2))
|
||||||
epd.display_fast(epd.getbuffer(image1))
|
epd.display_fast(epd.getbuffer(image1))
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@ -130,4 +133,4 @@ except IOError as e:
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logging.info("ctrl + c:")
|
logging.info("ctrl + c:")
|
||||||
epd2in13_V4.epdconfig.module_exit(cleanup=True)
|
epd2in13_V4.epdconfig.module_exit(cleanup=True)
|
||||||
exit()
|
exit()
|
Loading…
Reference in New Issue
Block a user