Updated code to clear the display

master
Ronald 1 year ago
parent 826de01c90
commit 54296e7bbe

@ -236,9 +236,6 @@ def main():
display.Init()
logging.info("clearing display")
display.clear()
width = display.width
height = display.height
image = Image.new('1', (width, height))
@ -261,7 +258,14 @@ def main():
display.ShowImage()
def clear_display():
display.clear()
buffer = Image.new('1', (width, height))
draw = ImageDraw.Draw(image)
draw.rectangle((0, 0, width, height), outline=0, fill=0) # black rectangle to clear screen, without clearing buffer
display.getbuffer(buffer)
display.ShowImage()
logging.info("clearing display")
clear_display()
if "DISPLAY_IN_TERMINAL" in config['SCREEN']:
if config['SCREEN']['DISPLAY_IN_TERMINAL'].lower() == "false":
@ -321,9 +325,6 @@ def main():
logging.error("the data returned from the API was not in an expected format")
continue
if show_on_screen:
clear_display()
glucoseMeasurement = graph['connection']['glucoseMeasurement']
if show_in_terminal:
@ -336,6 +337,8 @@ def main():
print(f"Refresh rate: {delay} seconds")
if show_on_screen:
clear_display()
draw.text((x, top), glucoseMeasurement['Timestamp'], font=font, fill=255)
draw.text((x, top+8), "Glucose units: " + str(glucoseMeasurement['Value']), font=font, fill=255)
# Don't know why these two need to have more spaces to line up with the line ebovee

Loading…
Cancel
Save