Actually, the line conn.on('close',function() {USB.setConsole();}) made the Wifi connect work
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.
It would be a shame to loose this functionality.
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 wifi.connect,save kind of thing anyway, where maybe just calling wifi.connect in onInit would give the programmer a bit more control over what happens if connection failed.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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
wifi.connect,save
kind of thing anyway, where maybe just callingwifi.connect
in onInit would give the programmer a bit more control over what happens if connection failed.