-
Referring back to post #9 above:
How about a new command line option, say
-x
that uses.expr()
and doesn't impact existing users of-e
? -
Had a look and it appears WebStorm doesn't read tern files. It likes
js
files that includeJSDocs
format comments.Before I launch into parsing the tern file into something else: is tern your source format you maintain my hand, or is there something behind that like a structured database I might find easier to work with?
-
Great,
and chance of seeing the the Eagle files for the espruino Pico 1r4 go up on gitHub at https://github.com/espruino/EspruinoBoard/tree/master/Pico/eagle -
OK. I can do what I need using the module form with my
console.mute()
work-around.
I plan on moving my build process to WebStorm and use the integrated gulp tools to upload code and run tasks on the espruino.
I really want the git/gitHub integration that WebStorm gives me as I live in fear I'll lose changes/history using the WebIDE. I've also found it doesn't save/cache the code in the code window once it exceeds a certain size (sorry but I didn't investigate too much), and I get inconsistent errors about not being able to find modules when modulesrequire()
other modules.To complete the integration it would be nice to figure out how to give WebStorm what it needs to be aware of the built-in espruino functions/libraries, especially where they differ from standard javaScript/node, e.g. the
E.
object and all the global h/w functions likedigitalWrite()
. I look into it and let you know if I find a solution. -
On http://www.espruino.com/ESP8266 there is a small error in the table titled Shim wiring: that gives the pin mappings from the espruino pico to the esp8266 for each revision of the shim.
For the rev 2 shim pin A2 is listed twice!
I believe the second occurence:
GPIO2 N/C A2
should read
GPIO2 N/C A0
I used the Eagle PCB visualisation tool at http://3dbrdviewer.cytec.bg/ to take a close look at the shim PCB and think I've got this right.
-
-
The
expr
function isn't behaving as I'd expected:- when I
require('espruino')
in node and useexpr
then I get a lot of info on the console and there is no option to suppress this like there is with the cli-quiet
option. - when I use the cli
-e
option then I never see the output that is returned from the esprino as there is no way to register a callback like there is withrequire('espruino').expr()
I have a work-around for the first issue, see attached
require('esp-console'); esp = require('espruino'); console.mute(); esp.expr(port, 'getTime()', function(m) { console.info(m); }); console.unmute();
Note the use of
console.info
in the callback, asconsole.log
is currently mute (by default).
You can mute any version ofconsole
using for exampleconsole.mute('error');
For the second issue, could you maybe set up a callback of
function(m) { console.log(m) };
whenespruino -e 'code...'
is used, so the output can be seen? - when I
-
Hi,
I've created a javaScript based module that implementsdecodeURIComponent
as it not currently a global function in espruino, although its partner functionencodeURIComponent
is.The attached file contains the module code.
I needed this to help with a larger body of work I have in progress and will share soon.Is there a chance this could be included as a built-in, global function in a future release of espruino?
If not, then I'd be happy if it was hosted somewhere in the espruinio ecosystem, or should I just use NPM and tag it for espruino? -
-
Hi,
I've really wanted to use webSockets with the Espruino & esp8266 as an http/webSockets server
but I was having some issues, namely:- the webSocket handshake was not completing until the server did its first send somewhere later, leaving the client waiting and unable to send data before the server did
- the client was closing the socket after 1 minute of inactivity because it was expecting the server to ping
- the server didn't know or gracefully close when the the client closed the webSocket
So I learnt more than I thought I would about the webSocket protocol and made the attached, simple changes that address these requirements (renaming the module to wsX.js just to avoid conflicts). A simple diff between the attached file and the hosted module will show you the few changes and I've added comments to explain, but feel free to remove these.
I'm now finding webSockets very reliable and doing what I need. I hope the changes I'm offering make it into the hosted module.
- the webSocket handshake was not completing until the server did its first send somewhere later, leaving the client waiting and unable to send data before the server did
-
Yes, I'm using 0.25
Looks like you fixedESP8266WiFi_0v25
right under my feet. Its now working without errors and I can listen/close/get/listen/... repeatedly without issue. So thanks for that.If I don't close the server, I can't make a get(client) request. If I do I get the following error
ERROR: Socket error -1 while sending
I'll put this to the test over time and make a final post in a day or so to let you know that it is working reliably without any fringe conditions.
-
-
-
Hmmm...
I wonder, does it still work as a server after that error?
I never thought to check that - and yes it does work, the server is running again.
So what do you recommend doing about the error? Can I wrap it in a 'try' and then ignore it, or is it something you might look into fixing?The scenario I am wanting to handle it to have a web server running most of the time, but I periodically (every 10 minutes) want to make a client call as I'm using the reponse.headers.Date from a reliable, local source to reset the time on the Pico with a call to setTime() because I am normally loosing a second every minute on the built-in RTC. SO if you have another solution for that I'm all ears.
-
On the ESP8266 WIFI MODULE page at http://www.espruino.com/ESP8266 under the heading GOTCHAS, it is very clear
You can only have one TCP/IP server, and while it is active you can not have any clients
In my mind this hinges on the word "active".
So I've used http://www.espruino.com/Reference#t_l_httpSrv_close to close a running http server and can then do a client require("http").get(...) successfully.
However, when I try to restart the server using another http://www.espruino.com/Reference#t_l_httpSrv_listen
I get the following error:Uncaught Error: CIPSERVER failed (no change) at line 2 col 20 (a?a:"Timeout")+")"); ^ in function called from system
Is there a way to restart the server or do I need to "createServer" again: seems wasteful?
-
-
I have only stated writing code for my Espruino Pico in the past 2 days.
When I add the"compiled";
directive to my code and try to "Send to Espruino" I get a red error popup in the bottom right-hand corner of the code panel that reads: "Error contacting server. Unable to compile code right now."
Is this a known issue, or am I doing something wrong?
I've been working away on what I mentioned in post #10 above, and have the two attached files to offer as a result.
Its not the
tern
based stuff but some other additions to the cli that I thought would be helpful.These are updates for both:
I apologise in advance that I haven't got around to doing these a pull-requests on gitHub. I'll get over my laziness soon and start proposing updates that way in future. For now I hope you'll do a diff and choose to integrate the changes if you like them.
These amount to:
serial_nodeserial.js
: applies a filter the to available ports and lists only ports that (hopefully) belong to an espruino (based on USB vendorId and productId)localModules.js
: implemented the relevant rules for require.resolve() from node so enable a more complete 'require()' experience with with cli.If I say so myself, I'm living and loving them both.