From b6fd390e03843d16d20970a331635c382f1176e5 Mon Sep 17 00:00:00 2001 From: Alexandre Esse Date: Tue, 11 Jun 2024 03:15:48 +0200 Subject: [PATCH 1/2] mqtt-all: fix display box The previous display box function wasn't properly used. This fix the information displayed on the enviro+ display. Signed-off-by: Alexandre Esse --- examples/mqtt-all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mqtt-all.py b/examples/mqtt-all.py index ecab4a3..db4cf87 100755 --- a/examples/mqtt-all.py +++ b/examples/mqtt-all.py @@ -136,7 +136,7 @@ def display_status(disp, mqtt_broker): message = f"{device_serial_number}\nWi-Fi: {wifi_status}\nmqtt-broker: {mqtt_broker}" img = Image.new("RGB", (WIDTH, HEIGHT), color=(0, 0, 0)) draw = ImageDraw.Draw(img) - x1, y1, x2, y2 = font.getbbox(message) + x1, y1, x2, y2 = draw.textbbox((0,0), message, font=font) size_x = x2 - x1 size_y = y2 - y1 x = (WIDTH - size_x) / 2 From f32e560580d32356858fddae2a3e18ef2eabb0ae Mon Sep 17 00:00:00 2001 From: Alexandre Esse Date: Tue, 11 Jun 2024 03:22:26 +0200 Subject: [PATCH 2/2] mqtt-all: update display message Signed-off-by: Alexandre Esse --- examples/mqtt-all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mqtt-all.py b/examples/mqtt-all.py index db4cf87..b4fd19e 100755 --- a/examples/mqtt-all.py +++ b/examples/mqtt-all.py @@ -133,7 +133,7 @@ def display_status(disp, mqtt_broker): text_colour = (255, 255, 255) back_colour = (0, 170, 170) if check_wifi() else (85, 15, 15) device_serial_number = get_serial_number() - message = f"{device_serial_number}\nWi-Fi: {wifi_status}\nmqtt-broker: {mqtt_broker}" + message = f"Serial: {device_serial_number}\nWi-Fi: {wifi_status}\nmqtt-broker: {mqtt_broker}" img = Image.new("RGB", (WIDTH, HEIGHT), color=(0, 0, 0)) draw = ImageDraw.Draw(img) x1, y1, x2, y2 = draw.textbbox((0,0), message, font=font)