partial update

This commit is contained in:
Robert Borzutzki 2022-10-19 13:16:12 +02:00
parent 7a50a21077
commit 842fe81a05

View File

@ -24,8 +24,8 @@ try:
epd = epd2in13_V2.EPD()
logging.info("init and Clear")
epd.init()
epd.Clear()
epd.init(epd.FULL_UPDATE)
epd.Clear(0xFF)
time.sleep(0.5)
# Drawing on the image
@ -35,16 +35,16 @@ try:
# Drawing on the Horizontal image
logging.info("1.Drawing on the Horizontal image...")
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)
drawred = ImageDraw.Draw(HRedimage)
#drawred = ImageDraw.Draw(HRedimage)
drawblack.text((5, 0), 'PV Produktion', 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, 45), 'Batterie %', font = font10, fill = 0)
drawblack.text((5, 60), 'Batterie Laden/Entladen', font = font10, fill = 0)
#epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
#epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
epd.display(epd.getbuffer(HBlackimage))
time.sleep(2)
except IOError as e:
@ -78,6 +78,9 @@ def on_message(client, userdata, msg):
line = 60
print(line)
epd.displayPartBaseImage(epd.getbuffer(HBlackimage))
epd.init(epd.PART_UPDATE)
drawblack.text((150, line), msg.payload.decode(), font = font10, fill = 0)
epd.displayPartial(epd.getbuffer(HBlackimage))
#print(f"`{msg.topic}`: `{msg.payload.decode()}`")