You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<buttonid="temp2" onclick="UART.getConnectionAsync().then(c=>c.espruinoEval('E.getTemperature()',{workaround:true})).then(function(x) { document.getElementById('temp2').innerHTML = 'Temperature '+x; })">Read Temperature (.espruinoEval)</button><br>
10
11
<buttononclick="UART.write('\x03var t=getTime()+5;while(getTime()<t);LED1.set();\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\n\'Lots and lots of text Lots and lots of text Lots and lots of text\'\nLED1.reset();\n');">Test flow control</button><br>
Add .espruinoEval(... {stmFix:true}) to work around occasional STM32 USB issue in 2v24 and earlier firmwares
90
92
1.07: Added UART.getConnection().espruinoEval
91
93
1.06: Added optional serialPort parameter to UART.connect(), allowing a known Web Serial port to be used
92
94
Added connectAsync, and write/eval now return promises
@@ -535,19 +537,25 @@ To do:
535
537
/* Send a JS expression to be evaluated on Espruino using using 2v25 packets.
536
538
options = {
537
539
timeout : int // milliseconds timeout
540
+
stmFix : bool // if set, this works around an issue in Espruino STM32 2v24 and earlier where USB could get in a state where it only sent small chunks of data at a time
538
541
}*/
539
542
espruinoEval(expr,options){
540
543
options=options||{};
541
544
if("string"!=typeofexpr)thrownewError("'expr' must be a String");
542
545
letconnection=this;
543
-
letresolve,reject,timeout;
544
546
returnnewPromise((resolve,reject)=>{
547
+
letprodInterval;
548
+
545
549
functioncleanup(){
546
550
connection.removeListener("packet",onPacket);
547
551
if(timeout){
548
552
clearTimeout(timeout);
549
553
timeout=undefined;
550
554
}
555
+
if(prodInterval){
556
+
clearInterval(prodInterval);
557
+
prodInterval=undefined;
558
+
}
551
559
}
552
560
functiononPacket(type,data){
553
561
if(type!=0)return;// ignore things that are not a response
0 commit comments