Wait a moment, IIRC ESP32/8266 connect to Wifi automatically, if wifi credentials were saved. And IIRC reset() will not disconnect from wifi, just resets Espruino interpreter. So yes, your wifi.on('connected' will not fire, because it's already connected to wifi by the time your code is executed.
So what I did is check in my startup code if it's connected to wifi. If not, than start connecting. If already connected, just run wifi releated startup code immediately.
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.
Wait a moment, IIRC ESP32/8266 connect to Wifi automatically, if wifi credentials were saved. And IIRC
reset()
will not disconnect from wifi, just resets Espruino interpreter. So yes, yourwifi.on('connected'
will not fire, because it's already connected to wifi by the time your code is executed.So what I did is check in my startup code if it's connected to wifi. If not, than start connecting. If already connected, just run wifi releated startup code immediately.