Skip to content

Commit

Permalink
Badger2040: Use Act LED. Avoid recreating files on every load.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Mar 25, 2022
1 parent b1fd893 commit a23cc59
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions micropython/examples/badger2040/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@

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())
Expand All @@ -40,15 +41,14 @@
except (OSError, ImportError):
pass

# Load images
try:
IMAGES = [f for f in os.listdir("/images") if f.endswith(".bin")]
TOTAL_IMAGES = len(IMAGES)
except OSError:
pass


display = badger2040.Badger2040()

image = bytearray(int(296 * 128 / 8))
current_image = 0
show_info = True
Expand Down

0 comments on commit a23cc59

Please sign in to comment.