From 842fe81a055ad9ef235aa7975b1c0c7ed8872d50 Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 13:16:12 +0200 Subject: [PATCH] partial update --- examples/mqtt.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/mqtt.py b/examples/mqtt.py index 3074e55..7036b05 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -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()}`")