From 8ce3939422a6eddb9ffd5fbcdfb1855732845177 Mon Sep 17 00:00:00 2001 From: David Todd Date: Sun, 26 Jan 2020 18:18:07 -0600 Subject: [PATCH] Change the way that blinking works --- pixo/pixels.py | 14 ++++++++------ pixo/wifi.py | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pixo/pixels.py b/pixo/pixels.py index ad4fb29..1462aaa 100644 --- a/pixo/pixels.py +++ b/pixo/pixels.py @@ -81,22 +81,24 @@ class Pixo: return self - def blink_image(self, image, show=True, delay=0.3): + def blink_image(self, image, force=(), delay=0.3): """ Fills the board with the provided `image`, which is a list of tuples containing RGB values - When `show` is False, the board will not be updated - automatically. This is useful if chaining commands - together (such as setting the image, and then forcing - a specific color for active pixels in the image) + When `force` is set, it should be a tuple of + RGB values; it will override all colors on the + board that are active. `delay` is a float of how many seconds to wait before the board gets blanked out. To blink multiple times, call this in a loop """ - self.fill_image(image, show) + if len(force) > 0: + self.fill_image(image) + else: + self.fill_image(image, False).force_color(force) time.sleep(delay) self.fill((0, 0, 0)) diff --git a/pixo/wifi.py b/pixo/wifi.py index 889627c..cf80254 100644 --- a/pixo/wifi.py +++ b/pixo/wifi.py @@ -23,7 +23,7 @@ if not STA_IF.isconnected(): STA_IF.connect(creds.WIFI_SSID, creds.WIFI_PASSWORD) while not STA_IF.isconnected(): - Pixo().blink_image(WIFI_IMG, False).force_color((200, 40, 40)) + Pixo().blink_image(WIFI_IMG, (200, 40, 40)) if time.time() - start_time >= MAX_WAIT: break