You are reading a single comment by @AkosLukacs and its replies. Click here to read the full conversation.
  • Hi!

    Just connecting to the AP, and then saving Wifi credentials with Wifi.save() was the best for me.
    Wifi tries to reconnect if disconnected from the AP without any explicit code. Connect and reconnect sometimes completes quickly, sometimes it takes longer. And this can mess if you have timed reconnects.

    Also, in the function

    function iw2(){
      if(wifi_stat !== "connected") {
        wifi_recon_count++;
        wifi_pre_mem = process.memory().free;
        print("WIFI disconnected: Reconecting...");
        Wifi.connect(wifi_options.ssid, {password: wifi_options.password});
        wifi_post_mem = process.memory().free;
      }
      setTimeout(iw2,1000*30);
    }
    

    The status can be for example connecting, if the function runs just after a random disconnect, while the ESP is still trying to connect. Calling Wifi.connect() while connecting caused all kinds of strange behaviour for me.

About

Avatar for AkosLukacs @AkosLukacs started