Right now, the times reported for things in events are... uh.... wrong.
On an Arduino, clocked off a crystal, I can constrain the 1 and 0 lengths like so:
// Version 2.1
int rxSyncMin = 1900; //minimum valid sync length
int rxSyncMax = 2100; //maximum valid sync length
int rxZeroMin = 120; //minimum length for a valid 0
int rxZeroMax = 400; //maximum length for a valid 0
int rxOneMin = 450; //minimum length for a valid 1
int rxOneMax = 750; //maximum length for a valid 1
int rxLowMax = 600; //longest low before packet discarded
int txOneLength = 550; //length of a 1
int txZeroLength = 300; //length of a 0
int txLowTime = 420; //length of the gap between bits
int txTrainRep = 30; //number of pulses in training burst
int txSyncTime = 2000; //length of sync
int txTrainLen = 200; //length of each pulse in training burst
The Arduino receiver happily takes the transmission and yields the correct result. With no interrupts or hardware timing more advanced than micros():
+1FE10001
Now, let's look at what lengths we get for those under Espruino:
Note how the numbers are all WAY LOWER than they should be. Those decoding results are after I lowered the threshold for 0 vs 1 down to 0.000295, in an attempt to get everything out of the 0 range, and widened the threshold for accepting, ie:
function sigOff(e) {
var d=e.time-e.lastTime;
console.log(d);
if (d>0.00012 && d<0.00075) {n+=d>0.000295?1:0;}
else {n="";}
if (n.length==z) parseRx(n);
}
This is with analog squelching, by the way - it works splendidly. I can still receive without it - and it doesn't change the fact that the times are all over the place and consistently way under what they should be.
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.
Right now, the times reported for things in events are... uh.... wrong.
On an Arduino, clocked off a crystal, I can constrain the 1 and 0 lengths like so:
The Arduino receiver happily takes the transmission and yields the correct result. With no interrupts or hardware timing more advanced than micros():
+1FE10001
Now, let's look at what lengths we get for those under Espruino:
Note how the numbers are all WAY LOWER than they should be. Those decoding results are after I lowered the threshold for 0 vs 1 down to 0.000295, in an attempt to get everything out of the 0 range, and widened the threshold for accepting, ie:
This is with analog squelching, by the way - it works splendidly. I can still receive without it - and it doesn't change the fact that the times are all over the place and consistently way under what they should be.