Version 1.18.5 - Brilliantly Better Badger Battery
👇 Scroll down to find .uf2 files under "Assets". There are now too many to manually list at the top here! 👇
What's all this about battery, then?
The super exciting battery changes in this release have been brought to you by @MichaelBell, Bishop of Badger batteries and connoseuir of coins cells.
The TLDR is that battery life in apps like QRGen, Badge and Image is now immensely improved while running from AA, AAA, LiPo or Coin-cell batteries connected to the JST connector.
How did @MichaelBell achieve this enormous improvement? By just turning Badger 2040 off. Yup, MicroPython can't use any power if it's turned completely off. While I've been worring about sleep states and pin wake interrupts Michael has swept in with a brilliantly elegant solution. I wont say simple because there's some clever stuff happening here and it's taken a lot of work to make the best use of it. But it's elegant!
Badger OS now makes liberal use of text files to save the state of various apps, including which app was launched last. When the launcher fires up, it checks its own state and launches the last known app. That app will then load its own state and handle whatever button you pressed to wake up Badger 2040, update the screen and turn off the power again.
Now when you load the Badge app, for example, it'll display the badge and cut the power to your Badger 2040. Even the launcher itself will power off, so you wont drain the battery leaving it running!
Badger OS - what's changed?
- Exiting to the launcher is now done by pressing A + C simultaneously
- If a launcher app has an error, or is missing, you'll see a little on-screen message!
- There's a new
badger_os
module with some handy features for saving/loading app state and displaying warnings. - You should use
.pressed()
to handle buttons in Badger OS apps now. - If your app just shows something on screen, you can call
.halt()
to power off when you're done! ⚠️ The USER button doesn't work so well as a shift key on battery, since your Badger will wake up in bootloader mode! You can sorta fudge it by pressing USER quickly as the Badger starts up. It works as normal on USB power.
Known issues:
- Battery indicator mostly reads as disconnected, since it needs some time for the vref to stabalise.
- If you delete images and have an app state saved to show an out-of-range image, you'll get an IndexError.
Other Changes
- A nasty bug in PAA5100 / PMW3901 has been fixed, which would cause very confusing errors when trying to read data.
- An awesome new Conway's Game Of Life example for Badger 2040.
- Assorted minor tweaks and fixes, thank you to all who contributed these!
Full Changelog: v1.18.4...v1.18.5
Merged PRs
- Fix filenames in examples README, some minor code tweaks by @andypiper in #296
- Badger2040: Add sleep to help and info by @Gadgetoid in #298
- PAA5100/PMW3901 Fix default float argument bug for #228 by @Gadgetoid in #302
- Combine PAA5100 and PMW3901 into a single module for #301 by @Gadgetoid in #303
- Conway's game of life for Badger2040 by @samuelmcdermott in #304
- Badger2040: Fix builtin module depends typo. by @Gadgetoid in #315
- Badger2040 Micropython battery improvements by @MichaelBell in #313
New Contributors
- @samuelmcdermott made their first contribution in #304