So there is currently no build step to prepopulate storage area from files in some folder and merge it with the hex file? Possibly because I may often not want that as the memory is retained between flashing new espruino version?
I checked gen/jswrapper.c how modules work and what happens with JSMODULESOURCES+=libs/js/SSD1306.min.js part and now I understand.
So the module is simple string that gets parsed when require(string) is called. And then some function inside the module is just a variable pointing to its javascript source stored directly inside that module string in flash. And when called it is interpreted directly from flash memory.
BTW, maybe I have figured our battery voltage level. Looks like the D2 pin that gets high when charging can be read as analog value. And D3 too. So when I do vmult=5/analogRead(D2) when charging, then with vmult*analogRead(D3) any time later I get some sensible number like 4.2 that goes down a bit with time. Over night it went down to 4.0 with serial console atteched.
Also the Web IDE is very cool, I opened it on android tablet directly from the link (with Samsung Internet browser) and I could connect to the watch over bluetooth. The console is a bit slower than serial when going up in history and editing the line but it is still quite usable :-) This is so polished. Really good stuff.
And I got very simple watch like functionality (press button to show time for 5 seconds) with short code like
function mydrawfunction(){
if (BTN1.read()) {
g.on();g.drawText(new Date,0,12);g.flip();
setTimeout(function(){g.off()},5000);
}
}
setWatch(mydrawfuntion,BTN1,true);
coded directly in the console. I wonder how long it would take to do this with Arduino C code :-)
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.
So there is currently no build step to prepopulate storage area from files in some folder and merge it with the hex file? Possibly because I may often not want that as the memory is retained between flashing new espruino version?
I checked gen/jswrapper.c how modules work and what happens with
JSMODULESOURCES+=libs/js/SSD1306.min.js
part and now I understand.So the module is simple string that gets parsed when require(string) is called. And then some function inside the module is just a variable pointing to its javascript source stored directly inside that module string in flash. And when called it is interpreted directly from flash memory.
BTW, maybe I have figured our battery voltage level. Looks like the D2 pin that gets high when charging can be read as analog value. And D3 too. So when I do
vmult=5/analogRead(D2)
when charging, then withvmult*analogRead(D3)
any time later I get some sensible number like 4.2 that goes down a bit with time. Over night it went down to 4.0 with serial console atteched.Also the Web IDE is very cool, I opened it on android tablet directly from the link (with Samsung Internet browser) and I could connect to the watch over bluetooth. The console is a bit slower than serial when going up in history and editing the line but it is still quite usable :-) This is so polished. Really good stuff.
And I got very simple watch like functionality (press button to show time for 5 seconds) with short code like
coded directly in the console. I wonder how long it would take to do this with Arduino C code :-)