Got display working

This commit is contained in:
Zakary Timson 2024-07-27 21:05:48 +00:00
parent 8f9a7de613
commit dc98fd122d
10 changed files with 16 additions and 9 deletions

View File

@ -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..."

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Binary file not shown.

View File

@ -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

View File

@ -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)