Everyone, do not let @neil sell you a watch!
He suggested to me that I get a PrimeTime once, and then I fell into a deep hole of programming it with WaspOS and MicroPython for a month or two. Nothing else could hold me interest all through January.
Now I have a one of a kind watch running software nobody else in the world runs and an understanding of tiny memory-footprint constraints in a Micropython environment.
Sure, it's great, but I'll never get that month back.
@pre @neil always open for a new watch face if you have a link
Try mine via https://codeberg.org/falken/wasp-os-apps ?
@falken Indeed. Micropython is a memory hog. Just storing a single int variable takes like 16 bytes.
Gotta write it tight to keep memory under control. I ended up allocating a word-array and indexing into that for all my variables.
@pre hmm. I'm new to embed systems.
Is the compiler clever enough that this is a good pattern and saves RAM over using two ints then? Eg it optimises away the two const ints:
vars=[]
const variable_one = 0
const something_else = 1
...
vars[something_else] = do_some_maths(vars[variable_one]
@falken I wouldn't wanna give the impression that I know what I'm doing exactly.
There's a micropython library called "const"
> from micropython import const
It means you can define names that are compile-time reduced without putting the names in the image:
> _FONTNUM = const(0)
You can then define a memory-chunk you need:
> self._wordvars = array.array("H",range(_MAXVARS))
[_MAXVARS is a const defined at the top more than all the others]
Then access them as needed:
> self._wordvars[_FONTNUM] = 0
Then each word-var is 16 bits instead of like 16 bytes even for a bool.
Doing that over having python objects for every variable was the biggest memory-saver.
@falken Sure, he's my fork.
https://github.com/revpriest/pre-wasp-os
I do still intend to do a pull request eventually, but there's at least one bug still and seems like the maintainer prefers to have it all in one big chunk than deal with weekly pull requests as I find and fix the tiny things.