@allObjectsE.getSizeOf(xxx) is what I'd suggest - just have a play around and see how much space things take.
@DrAzzy sounds great about cutting it down... getting rid of writel is great - ideally things using write shouldn't really have to worry about the page issues.
With debug code, I just tested this: If you add var D=X; up the top of the module then when it is minified, the closure compiler is smart enough to pull out the unreferenced code:
var D=false;
exports.foo = function() {
if (D) console.log("Debug");
console.log("World");
}
With nToS/etc - they could be in a separate module. For easy access of ints/etc you can also use ArrayBufferView too (if the source data is an arraybuffer): (new Uint16Array(arr.buffer,0,1))[0].
Wrt I2C - if I2C.readFrom returned a Uint8Array, would it break anything? It'd be faster and more memory efficient for sure.
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.
@allObjects
E.getSizeOf(xxx)
is what I'd suggest - just have a play around and see how much space things take.@DrAzzy sounds great about cutting it down... getting rid of writel is great - ideally things using
write
shouldn't really have to worry about the page issues.With debug code, I just tested this: If you add
var D=X;
up the top of the module then when it is minified, the closure compiler is smart enough to pull out the unreferenced code:With nToS/etc - they could be in a separate module. For easy access of ints/etc you can also use ArrayBufferView too (if the source data is an arraybuffer):
(new Uint16Array(arr.buffer,0,1))[0]
.Wrt I2C - if
I2C.readFrom
returned a Uint8Array, would it break anything? It'd be faster and more memory efficient for sure.