-
• #2
E.toString() is working perfect and is not the root cause.
It is no a good idea to block the esp with large outputs, because this can cause a reboot :)
Hint: use tdata.fill(0x30)
-
• #3
Is the issue that you got bitten by the watchdog as MaBe suggested?
Or are you claiming the output of E.toString() is incorrect? (it's not, 0x30 is ascii code for "0" )
-
• #4
It were the watchdog timer doing the reset.
This works.var chk=1024; var tdata=new Uint8Array(chk); var i=0; tdata.fill(0x30); function draino(){ } D=new draino(); D.on('drain',function(){ console.log(i);i++; console.log(E.toString(tdata)); process.memory(); //fails if this is commented }); setInterval(function (){ D.emit('drain'); },100);
The emit and drain are simulating serving data to a socket.
Code for doing that would obsfucate the issue a bit more.Gordon has addressed the problem shown by commenting out the process.memory, but his fix isn't in the published 1v95 code yet.
Thanks for the tip about the watchdog. The ESP8266 Espruino is a different paradigm from the Pico. Is there a similar watchdog in the ESP32 Espruino?
-
• #5
Have you tried this on the cutting edge builds yet to see if it's any different?
Problem with E.toString in Espruino 1v95 on ESP8266-4MB
Erase flash
Flash the chip (uses DIO)
Run this program
4 Here's the output
Skipping some output to save space