kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Badger2040: Use Act LED. Avoid recreating files on every load.
rodzic
b1fd8936cf
commit
a23cc59e3c
|
@ -22,13 +22,14 @@ OVERLAY_TEXT_SIZE = 0.5
|
||||||
|
|
||||||
TOTAL_IMAGES = 0
|
TOTAL_IMAGES = 0
|
||||||
|
|
||||||
|
|
||||||
|
# Turn the act LED on as soon as possible
|
||||||
|
display = badger2040.Badger2040()
|
||||||
|
display.led(128)
|
||||||
|
|
||||||
# Try to preload BadgerPunk image
|
# Try to preload BadgerPunk image
|
||||||
try:
|
try:
|
||||||
os.mkdir("images")
|
os.mkdir("images")
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
import badgerpunk
|
import badgerpunk
|
||||||
with open("images/badgerpunk.bin", "wb") as f:
|
with open("images/badgerpunk.bin", "wb") as f:
|
||||||
f.write(badgerpunk.data())
|
f.write(badgerpunk.data())
|
||||||
|
@ -40,6 +41,7 @@ try:
|
||||||
except (OSError, ImportError):
|
except (OSError, ImportError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Load images
|
||||||
try:
|
try:
|
||||||
IMAGES = [f for f in os.listdir("/images") if f.endswith(".bin")]
|
IMAGES = [f for f in os.listdir("/images") if f.endswith(".bin")]
|
||||||
TOTAL_IMAGES = len(IMAGES)
|
TOTAL_IMAGES = len(IMAGES)
|
||||||
|
@ -47,8 +49,6 @@ except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
display = badger2040.Badger2040()
|
|
||||||
|
|
||||||
image = bytearray(int(296 * 128 / 8))
|
image = bytearray(int(296 * 128 / 8))
|
||||||
current_image = 0
|
current_image = 0
|
||||||
show_info = True
|
show_info = True
|
||||||
|
|
Ładowanie…
Reference in New Issue