EspruinoWiFi module builtin? #1155
Replies: 29 comments
-
Posted at 2018-02-02 by verdeimpacat I trust it is not built-in. You will need to have in the initialization part of your code a line like:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-02 by @allObjects
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-03 by Steffen Thanks for clarification., using save() for wifi and onInit() for the connection works well. Now I wonder why the not official ESP8266 gets such goodness built it, including a telnet server, and the official Espruino WiFi needs extra initialization to enable networking. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-03 by @gfwilliams I'm working on building the module in, but you'll still have to require it even with that... But then your have to require ("WiFi") on ESP8266 too, so I'm not really sure what the difference is? And yes, Telnet too. It's just a few lines to enable on Espruino WiFi, but doing it properly (so it survives a 'reset') is hard, and I don't want to build it in until it works nicely |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-04 by Steffen This is good news and telnet surviving reset would be a good reason for me to upgrade the firmware. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-05 by @gfwilliams Thanks! I've recently added the ability to include JS modules so I should get the module included for 1v96. If you're interested in Telnet, this should work to enable it:
Although as above, you can't have |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-05 by Steffen And if this code, along with the wifi setup (all nicely wrapped in a function), is set e.g. by E.setBootCode(..) - will it come up again after reset()? Such that a new telnet session can be established without cycling power of the device? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-06 by @gfwilliams Yes, absolutely! Just remember |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-07 by @gfwilliams If you now use a 'cutting edge' build for Espruino WiFi from http://www.espruino.com/binaries/travis/master/ it now has the EspruinoWiFi module built in. It's also accessible via |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-07 by @MaBecker Wow this is great - so there is just missing something like require('Wifi').save() to save connection data to survive power off or reboot Have you thought about a special section to store wifi connection data and other data eg mqtt server and topic or .....? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-07 by Wilberforce Should that be |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-08 by @MaBecker ESP8266 and ESP32 boards use EspruinoWiFi boards use |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-08 by @gfwilliams
They really don't - it was literally just a typo in my original post, which I have now corrected :) Did you actually try it and notice a problem? I'm still not sure about the I am working on something that'll open up the standard Espruino saved code area, and which will finally allow JS files to be written in chunks (so you can upload more data than there is RAM), so hopefully |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-08 by Steffen Requiring works. However, connect() succeeds only 1 out of 3 times (power off and on again). Here is my code:
With the 1v95 build connect() always succeeds. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-08 by @gfwilliams Interesting... do you have any error messages, or does it just not print anything? Is it responsive? And can you connect via Telnet? When I tried it, Telnet worked fine every time. However there seemed to be an issue with it not being responsive over USB. Please could you try this and see if it works:
I've added LED changes so you can see connection state, but the main thing is the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-09 by @MaBecker Haha, i thought you did it intentionally .... because it matches EspruinoWiFi. It's time for a less memory consuming solution, because this will allow ESP01 one more page to save code. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-10 by Steffen In case it doesn't work it writes 'WiFi connect failed: FAIL'. Actually, the line Regarding the LEDs, I'd expect the green one to go on once the Wifi connection is established. It doesn't, even when I can telnet to Espruino. Doing LED2.set() from the console works. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-11 by Wilberforce
The auto connection functionality is really useful if you connect via telnet over IP. It means that you have a much faster connection than USB. It would be a shame to loose this functionality. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-12 by @gfwilliams
To me, this implies that some other computer is maybe trying to connect to port 23 briefly on the Espruino WiFi? The Telnet example before never returned the console when you disconnected, so that's sort of what you'd expect - Espruino WiFi would stay running, but you wouldn't be able to communicate over WiFi without that line above.
I'm not planning on removing it from ESP32/8266/etc. But yes, for Telnet it's super handy - but I think that's the main one? obviously if you've got code already on the device then in many cases (IMO) it makes it more readable to have code there that explicitly connects to WiFi. Most ESP8266 code I've seen starts with a |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-12 by opichals I find it quite a good feature of not having to include the SSID and credentials to the actual device code. It doesn't belong there. I use I wish I could do something like |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-13 by @gfwilliams Hopefully this new flash storage thing will open things up. At the very least you'll be able to put your WiFi credentials in You probably know this, but if you do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-13 by Ollie @opichals you could wrap that in a bash file and pass in flags, no? I use a small Go utility for ESP8266 which does exactly this - and returns IP address so subsequently can connect via IDE over Telnet |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-15 by opichals @gordon Thanks for the 'Storage' module! Its use should to be a great way of not having to duplicate the serialization ( BTW What would you think of using a leading dot (or perhaps some other character of your liking) in the filename as a nice way of distinguishing internal files. Also thank you for the onInit() { on('connected', ...) } note, I haven't noticed that before for some reason. @ollie I somehow didn't spend too much time but I think I could not find a way to pass arguments/env variable values to the espruino npm's cli .js script. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-16 by @gfwilliams Yes, that's the idea - just JSON stringify and parse. We could use a leading dot - I guess it would make it easier to automatically remove system/non-system files. And yes, I will end up adding autoconnect for the WiFi at some point. Not sure when yet though! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-19 by @allObjects Why not put credentials into a module? ...that's what I do... see this conversation about Connecting EspruinoWiFi to computer over WiFi... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-19 by opichals @allObjects While putting the credentials into a module is a possible way of 'hiding' it from the application module it still logically doesn't belong there. It forces people using or deriving the application code to have such module as well or to change the code which is not clean. There is also security aspect which we might want to think of. The configuration API should be done so that the sensitive information could be stored encrypted in a safe place and not in flash memory (something the BigClown core module would support). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-19 by @gfwilliams While this hasn't been posted on the forum yet, new (cutting edge, 1v96 and later when released) firmwares now have a nonvolatile
There will be some JSON support in there soon as well, but this should make everyone's life a lot easier. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-19 by @gfwilliams You can now do:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-28 by @allObjects @opichals, until you blow the fuse, nothing is safe in an mc... but I very well see your point. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-02 by Steffen
I've got a brand new EspruinoWifi and flashed v1.95 via web IDE.
From http://www.espruino.com/Modules I take it that the module EspruinoWifi (or .. 0V25) is builtin, but this doesn't seem to be the case.
Is this a glitch in the docs or in the code - or do I miss something?
Beta Was this translation helpful? Give feedback.
All reactions