diff options
author | Jakob Stendahl <jakobste@uio.no> | 2021-10-21 22:25:38 +0200 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2021-10-21 22:27:16 +0200 |
commit | 2389ba6cd27dadabf020b128c131aa5086389d87 (patch) | |
tree | ef6531924f1ecb592b5f9f13645da1e26ba58073 | |
parent | f6d2fa6faee7ca5482711c2737170f61e8342425 (diff) | |
download | Luxcena-Neo-2389ba6cd27dadabf020b128c131aa5086389d87.tar.gz Luxcena-Neo-2389ba6cd27dadabf020b128c131aa5086389d87.zip |
:sparkles: Blank pixels on exit
-rw-r--r-- | NeoRuntime/Runtime/luxcena_neo/strip.py | 15 | ||||
-rw-r--r-- | NeoRuntime/Runtime/neo_runtime.py | 1 |
2 files changed, 9 insertions, 7 deletions
diff --git a/NeoRuntime/Runtime/luxcena_neo/strip.py b/NeoRuntime/Runtime/luxcena_neo/strip.py index 9a12969..d673e1b 100644 --- a/NeoRuntime/Runtime/luxcena_neo/strip.py +++ b/NeoRuntime/Runtime/luxcena_neo/strip.py @@ -49,13 +49,8 @@ class Strip: self.strip.begin() # Blank out all the LEDs - i = 0 - while True: - self.strip.setPixelColor(i, 0) - i += 1 - if (i > self.LED_COUNT): break - self.strip.show() - + self.blank() + # Setup matrix print(" * Generating matrix") # try: @@ -150,6 +145,12 @@ class Strip: def get_pixel_color(self, n): """Get the 24-bit RGB color value for the LED at position n.""" return self.strip.getPixelColor(n) + + def blank(self): + """Will turn off all pixels, this also calls show for you.""" + for n in range(self.LED_COUNT): + self.set_pixel_color(n, 0) + self.show() def color_from_rgb(red, green, blue, white=0): diff --git a/NeoRuntime/Runtime/neo_runtime.py b/NeoRuntime/Runtime/neo_runtime.py index caa367e..01e5a9e 100644 --- a/NeoRuntime/Runtime/neo_runtime.py +++ b/NeoRuntime/Runtime/neo_runtime.py @@ -80,6 +80,7 @@ class NeoRuntime: traceback.print_exc() finally: self.__close_socket() + self.__strip.blank() def __bind_socket(self): |