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