change to bc lib

This commit is contained in:
Robert Borzutzki 2022-10-19 19:43:32 +02:00
parent 094db8dd51
commit 7ed57cd07e

View File

@ -8,7 +8,7 @@ if os.path.exists(libdir):
sys.path.append(libdir) sys.path.append(libdir)
import logging import logging
from waveshare_epd import epd2in13d from waveshare_epd import epd2in13bc
import time import time
from PIL import Image,ImageDraw,ImageFont from PIL import Image,ImageDraw,ImageFont
import traceback import traceback
@ -34,7 +34,7 @@ client_id = "solarmonitor"
try: try:
logging.info("epd2in13bc Demo") logging.info("epd2in13bc Demo")
epd = epd2in13d.EPD() epd = epd2in13bc.EPD()
logging.info("init and Clear") logging.info("init and Clear")
epd.init() epd.init()
epd.Clear() epd.Clear()
@ -47,16 +47,16 @@ try:
# Drawing on the Horizontal image # Drawing on the Horizontal image
logging.info("1.Drawing on the Horizontal image...") logging.info("1.Drawing on the Horizontal image...")
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
#HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
drawblack = ImageDraw.Draw(HBlackimage) drawblack = ImageDraw.Draw(HBlackimage)
#drawred = ImageDraw.Draw(HRedimage) drawred = ImageDraw.Draw(HRedimage)
drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0) drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0)
drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0) drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0)
drawblack.text((5, 30), 'Strom Import/Export', font = font10, fill = 0) drawblack.text((5, 30), 'Strom Import/Export', font = font10, fill = 0)
drawblack.text((5, 45), 'Batterie %', font = font10, fill = 0) drawblack.text((5, 45), 'Batterie %', font = font10, fill = 0)
drawblack.text((5, 60), 'Batterie Laden/Entladen', font = font10, fill = 0) drawblack.text((5, 60), 'Batterie Laden/Entladen', font = font10, fill = 0)
#epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage)) epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
epd.display(epd.getbuffer(HBlackimage)) #epd.display(epd.getbuffer(HBlackimage))
#time.sleep(1) #time.sleep(1)
@ -65,7 +65,7 @@ except IOError as e:
except KeyboardInterrupt: except KeyboardInterrupt:
logging.info("ctrl + c:") logging.info("ctrl + c:")
epd2in13d.epdconfig.module_exit() epd2in13bc.epdconfig.module_exit()
exit() exit()
@ -157,7 +157,7 @@ try:
drawblack.rectangle((150, 60, 220, 50), fill = 1) drawblack.rectangle((150, 60, 220, 50), fill = 1)
drawblack.text((150, 60), value_houseBatteryLoadUnload, font = font10, fill = 0) drawblack.text((150, 60), value_houseBatteryLoadUnload, font = font10, fill = 0)
epd.display(epd.getbuffer(HBlackimage)) epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
except KeyboardInterrupt: except KeyboardInterrupt:
print("exiting") print("exiting")