Pull CPP files (Online makecode.microbit.org)

Hey @mwest226 ,

I had some time over the past couple of days, so I created a prototype extension for get/put to flashstorage: https://github.com/bsiever/microbit-pxt-flashstorage .

I haven’t (yet) added support for anything other than storing and retrieving strings. Here’s a demo that actually stores a counter value by converting it to/from a string: https://makecode.microbit.org/_hiXaDp0aoAuF

  • It’ll retrieve a stored counter when it starts.
  • Button A increases the counter (but doesn’t update flash)
  • Button A+B decreases the counters (but doesn’t update flash)
  • Button B will update the flash with the current counter.

It also has some simulator support…but the simulator doesn’t really have flash so the refresh/reload resets all stored values. Still, if there is a store/put in one block and a retrieve/get in another, I think it’ll appear to work ok.

If a value isn’t in the storage the get() returns an empty string, so string length can be checked to see if a get() fails. It can use a lot more testing and a little cleanup. I think other functionality, like overloading for numeric types, can all be done just within the flashstorage.ts.

Hope that helps!