Okay @Gordon... I have finally got the reason why my App code is failing and sample code is working. I decided to read the compact documentation more closely to realise it fails if there isn't enough RAM. Digging through the code showed me it needs atleast allocated + 1024 to continue with compact. I haven't traced it as far as how much is allocated but when I have my app loaded and I run process.memory() I get this:
This means, require("Storage").compact() is ineffective if you have Bootloader + Default Launcher + Battery Widget + BT Widget + Settings and 1 clock App.
How we resolve this I am not sure, maybe after erase compact is called without the check for minimum RAM? Will that work? I have to dig deeper, but essentially we have an issue where we are unable to realise the full potential of Bangle and the storage it has.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Okay @Gordon... I have finally got the reason why my App code is failing and sample code is working. I decided to read the
compact
documentation more closely to realise it fails if there isn't enough RAM. Digging through the code showed me it needs atleastallocated + 1024
to continue withcompact
. I haven't traced it as far as how much isallocated
but when I have my app loaded and I runprocess.memory()
I get this:Even if allocated is 126 or 256, we can see the amount of free memory (1036) isn't enough for compact to continue.
However, the reason my sample above kept working is because on a Bangle with everything erased, if I run
process.memory()
I get the following:This means,
require("Storage").compact()
is ineffective if you have Bootloader + Default Launcher + Battery Widget + BT Widget + Settings and 1 clock App.How we resolve this I am not sure, maybe after erase
compact
is called without the check for minimum RAM? Will that work? I have to dig deeper, but essentially we have an issue where we are unable to realise the full potential of Bangle and the storage it has.