Skip to content

Commit

Permalink
Badger2040: Sleep after writing the book, to fix possible write delay…
Browse files Browse the repository at this point in the history
… when on battery
  • Loading branch information
MichaelBell committed Mar 25, 2022
1 parent e0e34fe commit 72ff77a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion micropython/examples/badger2040/ebook.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import badger2040
import time
import gc
import badger_os

Expand All @@ -13,7 +14,10 @@
# If the specified file doesn't exist,
# pre-populate with Wind In The Willows
import witw
open(text_file, "wb").write(witw.data())
with open(text_file, "wb") as f:
f.write(witw.data())
f.flush()
time.sleep(0.1)
del witw
except ImportError:
pass
Expand Down

0 comments on commit 72ff77a

Please sign in to comment.