Most recent activity
-
Building a lexer that handles serial output is painful, because you never know when the output finishes. Imagine sending multiple commands in quick succession which return one or multiple lines, building something to properly handle that is really tricky, especially if the first commands take longer to return.
I didn't know about theSerial1.setConsole
, I will take a look and see what options are available.I don't view implementing additional options on the espruino itself as a good idea, because these just take up memory and force other users to use the same options. For example, I would be interested in a "search-through-history" feature where you press
ctrl+r
like on linux, start typing some text and the matching commands are shown, and I already implemented something similar in here, but most users wouldn't even be aware of that.Take a look at how other projects do it, the most popular servers are distributed with a separate client (mysql, redis, mongodb). They implement a protocol, and you can build alternate clients for them if you need to.
Anyway, I'm totally fine with the status quo, these are just my 2c :P if the "cli-on-espruino" will not change and cannot be avoided/disabled, we'll just have to adapt to it.
-
(I think we should create separate threads of discussion if these go any further)
@Gordon I am aware of
echo(0)
, but that does not help. I want to know when a command finishes, in a consistent manner. At the moment, I can only read the output, which is inconsistent when single commands return single or multiple lines, and inconsistent when a command spans over multiple lines. I saw that you got over this problem by waiting for 100ms in the Web IDE, but that's a slow hack, not a proper solution solution.You said you wanted something easy to get started with, but not getting in the way if you want something more advanced. At the moment, the protocol only allows simple things and is getting in the way of something more advanced. I wanted to implement a more advanced cli, that's why I asked if there is a protocol other than espruino's cli.
My purpose was to have a cli which allowed command history, which sent minified commands, which only sent the commands once the code block was closed, and it should also implement internal commands such as
.sendFile('path/to/file.js')
. A GUI could be built on top of it, even integrated with chrome.If that is not possible, then I guess we'll have to deal with the current behavior, and simply forward everything to espruino and wait for 100-1000 miliseconds after every command.
-
I tried something similar, but the terminal implementation on the espruino itself is the painful part. I was surprised to find out that the board is the one implementing the CLI and the serial connection simply sends/receives text characters.
Is it possible to use a communication protocol and bypass espruino's CLI? Or maybe configure espruino to not send the cli prefix
>
, nor the response prefix=
. You could also view it as a consistency problem, espruino is sending\r\n
at the end of intermediate lines, and\r>
at the end of output, but interpreting the text is wrong and can lead to a lot of problems.Overall, is there a way to connect to the board without using its CLI, in order to implement a (proper) cli?
-
I tracked it down to the slide on the edge towards the 10uF condenser. Just pressing it down a little but using a pen makes the board work. I am pointing to the disconnected slide in this photo.
I took some photos using my phone since I don't have another camera. They are high res, but the phone's sensor is rather limited. Here's the link with the pictures, there is also an archive if you want to download all of them. Warning: large sized pictures.
-
Keeping the
RST
button pressed helped debug the issue. The contact between the connector and the board needs resoldering or a complete change, looks rather tricky for my bulky soldering iron. I guess they are not as resistant as I had hoped, I only plugged/unplugged the cable a couple of times. I guess I'll speed up my USB extension cable purchase :)If anyone is curious: applying pressure on the back of the board's connector (on the margin that sits towards the inside of the board) makes it work.
-
I was unaware that setTimeout supported timeouts of less than 1 ms, you have
0.07
. I don't yet know whether this is an Espruino feature.As for the
eval
'd strings, you can always pass a function that returns what you want to run, take a look at line 51. -
I'm not sure what the default value is for time or if you want
0.1
to be the time. I believe the second param should either be1
or0
, nothing in between. Try setting it all params explicitly, like this:digitalPulse(C7, 1, 100)
And make sure that
100
ms pass before running it again. Here is an example where I'm pulsating the led every 2 seconds, check out line 45.The official reference lists the format as
digitalPulse(pin, state, time)
, where:pin
idstate
either 1 or 0 (for high or low)time
in miliseconds
I doubt it will be, and you can define your own function or just use:
Please test this, I haven't :P