mirror of
https://github.com/c0de-archive/pixoPython.git
synced 2024-12-22 13:22:40 +00:00
Change the way that blinking works
This commit is contained in:
parent
a6f0b50619
commit
8ce3939422
@ -81,22 +81,24 @@ class Pixo:
|
|||||||
|
|
||||||
return self
|
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`,
|
Fills the board with the provided `image`,
|
||||||
which is a list of tuples containing RGB values
|
which is a list of tuples containing RGB values
|
||||||
|
|
||||||
When `show` is False, the board will not be updated
|
When `force` is set, it should be a tuple of
|
||||||
automatically. This is useful if chaining commands
|
RGB values; it will override all colors on the
|
||||||
together (such as setting the image, and then forcing
|
board that are active.
|
||||||
a specific color for active pixels in the image)
|
|
||||||
|
|
||||||
`delay` is a float of how many seconds to wait
|
`delay` is a float of how many seconds to wait
|
||||||
before the board gets blanked out.
|
before the board gets blanked out.
|
||||||
|
|
||||||
To blink multiple times, call this in a loop
|
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)
|
time.sleep(delay)
|
||||||
self.fill((0, 0, 0))
|
self.fill((0, 0, 0))
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ if not STA_IF.isconnected():
|
|||||||
|
|
||||||
STA_IF.connect(creds.WIFI_SSID, creds.WIFI_PASSWORD)
|
STA_IF.connect(creds.WIFI_SSID, creds.WIFI_PASSWORD)
|
||||||
while not STA_IF.isconnected():
|
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:
|
if time.time() - start_time >= MAX_WAIT:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user