In the above example, to start the code the application takes advantage of the built in Wifi event of having connected. Very often though, other initializations have to happen in controlled timing related to Wifi having connected. Luckily for code running on ESP8266 flavored boards, the Wifi connected event can be used to initialize things that have to happen after Wifi has connected. Wifi has a built in onPowerCycle to restart the connection with saved (Wifi save()) connection parameters and - on success - to emit this Wifi connected event.
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.
...indeed... therefore, take a look at this tutorial about How to have ONE codebase that works after both direct upload and save() with power cycle (run in no-save AND save mode), even though there are also other ways to get specific code starting after save() and power cycle.
In the above example, to start the code the application takes advantage of the built in Wifi event of having connected. Very often though, other initializations have to happen in controlled timing related to Wifi having connected. Luckily for code running on ESP8266 flavored boards, the Wifi connected event can be used to initialize things that have to happen after Wifi has connected. Wifi has a built in onPowerCycle to restart the connection with saved (Wifi
save()
) connection parameters and - on success - to emit this Wifi connected event.