You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • It's often not practical to make code that works both after direct upload and after save() and restart

    ...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.

About

Avatar for allObjects @allObjects started