It still needs a bit of work (for some unknown reason function parameters don't seem to be handled right, despite the generated code looking fine).
I've had to include two 'fake' parameters at the front, but the following does work though:
function f(x,xx,e) {
"compiled";
var d=e.time-e.lastTime;
if (d>0.0005 && d<0.0013) n+=d>0.0008?1:0;
else{
n="";
}
if (n.length==10) print(n);
}
n="";
f(0,0,{"time":0.0006, "lastTime":0});
f(0,0,{"time":0.001, "lastTime":0});
f(0,0,{"time":0.0006, "lastTime":0});
f(0,0,{"time":0.001, "lastTime":0});
f(0,0,{"time":0.0006, "lastTime":0});
f(0,0,{"time":0.001, "lastTime":0});
f(0,0,{"time":0.0006, "lastTime":0});
f(0,0,{"time":0.001, "lastTime":0});
f(0,0,{"time":0.0006, "lastTime":0});
f(0,0,{"time":0.001, "lastTime":0});
// prints 0101010101
So there is some hope for your radio receiver :)
If anyone is interested in diving in the source code is here. It should be significantly easier to work on and debug now - the C++ it generates is much more readable than Thumb assembly!
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.
Ok, new compiler online now.
It still needs a bit of work (for some unknown reason function parameters don't seem to be handled right, despite the generated code looking fine).
I've had to include two 'fake' parameters at the front, but the following does work though:
So there is some hope for your radio receiver :)
If anyone is interested in diving in the source code is here. It should be significantly easier to work on and debug now - the C++ it generates is much more readable than Thumb assembly!