From d3bc82243bcc237c8747f2a94d43bb4dbeb62e18 Mon Sep 17 00:00:00 2001 From: TheJoeCoder <joe@radialbog9.uk> Date: Wed, 2 Oct 2024 10:52:36 +0100 Subject: [PATCH] Add env toggle for LED state --- absled/dummy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/absled/dummy.py b/absled/dummy.py index 6ad0c90..671b2ec 100644 --- a/absled/dummy.py +++ b/absled/dummy.py @@ -1,3 +1,5 @@ +import os + from absled import ILedString @@ -7,6 +9,7 @@ class DummyLedString(ILedString): self.location = location self.leds = [(0, 0, 0)] * length self.real_leds = [(0, 0, 0)] * length + self.log_led_state = os.environ.get("LOG_LED_STATE", 0) == 1 def set_led(self, color: tuple[int, int, int], index: int): self.leds[index] = color @@ -26,4 +29,5 @@ class DummyLedString(ILedString): def show(self): self.real_leds = self.leds.copy() - print("LED State:", self.leds) \ No newline at end of file + if self.log_led_state: + print("LED State:", self.leds) \ No newline at end of file -- GitLab