From d19eab80a0aac2c370b28188c95dc2963181e9ad Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 11 Sep 2024 19:32:19 +0100 Subject: [PATCH] turn off LEDs and hexpansions on power off --- modules/firmware_apps/poweroff.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/firmware_apps/poweroff.py b/modules/firmware_apps/poweroff.py index 2885870..391765e 100644 --- a/modules/firmware_apps/poweroff.py +++ b/modules/firmware_apps/poweroff.py @@ -32,6 +32,21 @@ def draw(self, ctx): if not self.off: clear_background(ctx) if self.off: + from egpio import ePin + + HEXPANSION_POWER = { + (2, 12), + (2, 13), + (1, 8), + (1, 9), + (1, 10), + (1, 11), + } + for epin in HEXPANSION_POWER: + pin = ePin(epin, ePin.OUT) + pin.on() + pin = ePin((2, 2), ePin.OUT) + pin.off() ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill() ctx.font_size = 22 ctx.text_align = ctx.CENTER