Most recent activity
-
- 13 comments
- 225 views
-
Btw, I wanted to ask why it looks like I'm only slightly changing the route of data (as it still goes from REPL to IDE console through USB and vice versa) but on practice IDE console is loosing it's functionality ('ctrl+c' like u have said before, Up keyword doesn't print the previous command, backspaces don't properly clear console and etc). That all makes console kind of vulnerable for improper input. No way to change it?
-
-
I just wanted to say that when I catch console logs and answers from interactive console with code like this
USB.on('data', data => { inbuf.Push(data); }); setTimeout(() => {E.setConsole(LoopbackA);}, 200); LoopbackB.on('data', data => { outLogs.push(data); USB.write(data); }); setTimeout(() => { console.log('some text'); }, 500); setTimeout(() => { LoopbackB.write('2+3\r'); }, 1500);
I get logs like this:
[ "<- USB\r\n>", "\r\x1B[Jsome text\r\n>", "2+3\r\n=5\r\n>", "10+3\r\n=13\r\n>", "\r\x1B[J-> USB\r\n" ]
That looks quite readable, but some situations lead to logs like this:
"outLogs\r\n=[ \r\n \"" ... "\\n ]\\r\\n>\"\r\n ]\r\n>"
So I have to remove all special symbols somehow. Yeah, it's not hard at all to write a simple parser on regexps for those exact types of logs, but as I don't know how exactly IDE is formatting logs, I may easily trap into using code that doesnt work correctly for some cases. So, what would you advice?
-
Hello again. As REPL returns data (I am about data that comes on LoopbackB.on(data => ...) with various combinations of special symbols ['\r\n', '1x0B[', etc], I wanted to ask if it's possible to check all those "heads" and "tails" of messages.
Yes, in a common case, it's not hard to parse text from there with regexps, but this way I can easily not to take some cases into account. Thanks for attention! -
Hello again! That was a very helpful advice, but now I'm struggling with such a problem - obviously after LoopbackA.setConsole() I lose opportunity to prompt commands into IDE console and it is inacceptable accordint to my plans. What could You advise?
P.S looks like I already fixed it by piping default console (USB in my case) with LoopbackB.
-
I want to realize a certain logic, that would kind of change the way console.log works. I want it to send data not just into Espruino console, but into my webpage/node-red/somewhere else.
What would be the most optimal way to do it?As I work with various Espruino devices, it's very important to choose the universal way, so I would rely on usb connection, but not bluetooth or something else.
Thank in advance!
Thanks for all answers and advices you have given me! All of that was extremly helpful.