martes, 25 de octubre de 2022
(My) Best espruino apps (for bangle.js 1)
xx
miércoles, 5 de enero de 2022
Commands and developing for Espruino
IDE commands
reset(); //most common command when you find problems
after any freeze
require("Storage").eraseAll();
Removes all files, including apps that can't be removed from apps loader
E.setTimeZone(2);
peek16(0x300c).toString(16); //TO see the espruino SDK
//0x8C or 0x91 is SDK12
//0x81 or 0x88 is SDK11
Memory usage per app
print(require("Storage").list().map(f=>require("Storage").read(f).length.toString().padStart(7)+" - "+f).sort());
It'll list all files sorted by size and you can see what's taking up the space
Status
process.env;
process.memory();
require("Storage").getStats();
(total, free,...storage bytes)
E.getBattery() ;
print(require("Storage").list().map(f=>require("Storage").read(f).length.toString().padStart(7)+" - "+f).sort());
Device name (useful for Gadgetbridge)
bangle.js , puck.js , espruino, espruino-dev
NRF.setAdvertising({},{name:"espruino"});
Testing notifications
GB({t:"notify", id:5, src:"gadget",title:"Test",body:"message for testing notifications "});
Basics of developing
Logging:
console.log("Debug mode enabled");
Creating the icon
Compatibility and Dynamic code
Bangle.js1 =240x240
Bangle.js2= 176x176
var v_model=process.env.BOARD;
//EMSCRIPTEN,EMSCRIPTEN2
if (v_model=='BANGLEJS'||v_model=='EMSCRIPTEN') {