Primarily motivated to get almost everything out of globals and fix
issue #631. This is a stripped-down version of the gist there without
the memory debugging and reboot-into-direct-boot mode.
Mostly move things to functions. Clean up some dead code and comments.
I think the biggest win is not actually the PicoGraphics framebuffer,
which is well-behaved, but random temporary floats that were leaking
previously.
Also type-annotated and lints clean.
Fixes#631. (As much as I think is possible.)