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, powered by microcosm.
Report a problem