[GH-ISSUE #792] Different behaviour Wifimanager on 2 different ESP8266 12E #662

Open
opened 2026-02-28 01:26:27 +03:00 by kerem · 9 comments
Owner

Originally created by @randoniaina on GitHub (Dec 20, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/792

Basic Infos

Hardware

WiFimanager Branch/Release:

  • [x ] Master
  • Development

Esp8266/Esp32:

  • [x ] ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • [x ] ESP12 E/F/S (nodemcu, wemos, feather)
  • Other

ESP Core Version: 2.4.0, staging

  • [ x] 2.3.0
  • 2.4.0
  • staging (master/dev)

Description

Hello everyone,

I do face a very weird situation. I have 2 ESP8266 12e.

  • One that I worked on early 2018, on which I have Wifimanager library (don't remember the version since I upgrade this version since then).
    = > this board is connected to a wifi router

  • Two other boards on which I've bee working for 2 months and on which there are Wifimanager library also (version 0.14.0)
    = > These 2 boards are also connected to the SAME WIFI ROUTER.

The problem is that the last 2 boards launch the config portal randomly (for an unknown reason) : the Wifi routeur is always on WHEREAS the former board (on which I worked on early 2018) does NOT launch the config portal randomly.

The expected behaviour would be the 1st behaviour (that on the former board).

Can someone please help ? I cannot figure it out.

Here the code of the older board

#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>

//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> 


/*
Measuring AC Current Using ACS712
*/
const double sensorIn = A0;
int LED_PIN = 4;
int CONFIG_PIN = 12;
int statut_relay_actuel;
int statut_relay_avant;
int statut_line;

int mVperAmp = 30; // use 100 for 20A Module and 66 for 30A Module


double Voltage = 0;
double VRMS = 0;
double AmpsRMS = 0;

//const char *ssid = "DLINKAP";
//const char *password = "Disney";

const char* host     = "mydomain.com"; // Your domain
String path_relay          = "/Papa/Light/relay.json";
String path_relay_off          = "/Papa/Light/tester_relay.php?relay=off";
String path_on     = "/Papa/Light/tester.php?light=on";
String path_off     = "/Papa/Light/tester.php?light=off";

WiFiClient client;

void setup(){ 

  
 Serial.begin(115200);
 

 pinMode(LED_PIN, OUTPUT); //GPIO05 is an OUTPUT pin;

reconfiguration_init();
 

if (digitalRead(CONFIG_PIN) == 0) {
  
  ESP.restart();
}
 
}

void loop(){

//############ RAJOUT ############

if (digitalRead(CONFIG_PIN) == 0) {
  //reconfiguration();
  ESP.restart();
}

//############ FIN RAJOUT ############


Serial.print("connecting to ");
  Serial.println(host);
  
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }

 client.print(String("GET ") + path_relay + " HTTP/1.1\r\n" +
      "Host: " + host + "\r\n" +
      "Cache-Control: no-cache\r\n" +
      "Connection: keep-alive\r\n\r\n");

  delay(500); // wait for server to respond

  // read response
  String section = "header";
  while (client.available()) {
    String line = client.readStringUntil('\r');
    // Serial.print(line);
    // we’ll parse the HTML body here
    if (section == "header") { // headers..
      Serial.print(".");
      if (line == "\n") { // skips the empty space at the beginning
        section = "json";
      }
    }
    else if (section == "json") { // print the good stuff
      section = "ignore";
      String result = line.substring(1);

      // Parse JSON
      int size = result.length() + 1;
      char json[size];
      result.toCharArray(json, size);
      StaticJsonBuffer<200> jsonBuffer;
      JsonObject& json_parsed = jsonBuffer.parseObject(json);
      if (!json_parsed.success())
      {
        Serial.println("parseObject() failed");
        return;
      }

      // Make the decision to turn off or on the LED
      if (strcmp(json_parsed["relay"], "on") == 0) {
 
        switch_inter();
        
        
      }

    }
  }



 //--------------------Traitement statut sur internet---------------------
 
 Voltage = getVPP();
 VRMS = (Voltage/2.0) *0.707; 
 AmpsRMS = (VRMS * 1000)/mVperAmp;

 if (AmpsRMS > 1) {
    signal_allume();
 }
 else {
  signal_eteint();
 }
 Serial.print(AmpsRMS);
 Serial.println(" Amps RMS");

}

float getVPP()
{
  float result;
  
  double readValue;             //value read from the sensor
  int maxValue = 0;          // store max value here
  int minValue = 1024;          // store min value here
  
   uint32_t start_time = millis();
   while((millis()-start_time) < 1000) //sample for 1 Sec
   {
       readValue = analogRead(sensorIn);
//Serial.print("A0 == ");
//Serial.println(readValue);
       
       // see if you have a new maxValue
       if (readValue > maxValue) 
       {
           /*record the maximum sensor value*/
           maxValue = readValue;
       }
       if (readValue < minValue) 
       {
           /*record the maximum sensor value*/
           minValue = readValue;
       }
   }
   
   // Subtract min from max
   result = ((maxValue - minValue) * 5.0)/1024.0;
      
   return result;
 }

 void signal_allume(){

  statut_line = HIGH;
  Serial.print("connecting to ");
  Serial.println(host);
  WiFiClient client;
  client.stop();
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  //client.stop();
  
  client.print(String("GET ") + path_on + " HTTP/1.1\r\n" +
        "Host: " + host + "\r\n" +
        "Cache-Control: no-cache\r\n" +
        //"Connection: keep-alive\r\n\r\n");
        "Connection: close\r\n\r\n");

//digitalWrite(LED_PIN, HIGH);
//delay(2000);
//digitalWrite(LED_PIN, LOW);
//delay(500);
//digitalWrite(LED_PIN, HIGH);
//delay(2000);
//digitalWrite(LED_PIN, HIGH);
delay(100);
//statut = "allume";

  
 }

void signal_eteint(){

  statut_line = LOW;
  Serial.print("connecting to ");
  Serial.println(host);
  WiFiClient client;
  client.stop();
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  
  //client.stop();
  
  client.print(String("GET ") + path_off + " HTTP/1.1\r\n" +
        "Host: " + host + "\r\n" +
        "Cache-Control: no-cache\r\n" +
        //"Connection: keep-alive\r\n\r\n");
        "Connection: close\r\n\r\n");
//digitalWrite(LED_PIN, LOW);
delay(100);

//statut = "eteint";
  
 }

 void switch_inter() {

  WiFiClient client;
  client.stop();
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
    
  if (statut_relay_avant == LOW) {
    digitalWrite(LED_PIN, HIGH);
    statut_relay_avant = HIGH;
    
  }
  else {
    digitalWrite(LED_PIN, LOW);
    statut_relay_avant = LOW;
    
 }

 client.print(String("GET ") + path_relay_off + " HTTP/1.1\r\n" +
        "Host: " + host + "\r\n" +
        "Cache-Control: no-cache\r\n" +
        //"Connection: keep-alive\r\n\r\n");
        "Connection: close\r\n\r\n");

delay(100);
 
}

void reconfiguration_init(){
  if (WiFi.psk() != "") {
  Serial.print("wifi password : ");
  Serial.println(WiFi.psk());
  WiFi.begin();
  delay(5000);
    if (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print("wifi connection problem... going to portal");
    reconfiguration();
  }
} else {
  Serial.println("no wifi config ; starting portal...");
  reconfiguration();
}
}


//#######################DEBUT ###################"

void reconfiguration(){
// put your setup code here, to run once:
    Serial.begin(115200);
 
    //WiFiManager
    //Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wifiManager;
    //reset saved settings
    wifiManager.resetSettings();
    
    //set custom ip for portal
    wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
 
    //fetches ssid and pass from eeprom and tries to connect
    //if it does not connect it starts an access point with the specified name
    //here  "AutoConnectAP"
    //and goes into a blocking loop awaiting configuration
    wifiManager.autoConnect("AutoConnectAP");
    //or use this for auto generated name ESP + ChipID
    //wifiManager.autoConnect();
 
    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");


}

//####################### FIN ###################"

and this is the code on one of the latter board :

#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>

//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> 

#include <simpleBouton.h>

simpleBouton bouton(12);
uint32_t duree ;



char serverName[] = "api.pushetta.com";
boolean lastConnected = false;

int status = WL_IDLE_STATUS;


const char *ssid = "DLINKAP";
const char *pass = "Katarina_01";

const char* host     = "ccm-lhta.net"; // Your domain
const int httpPort2 = 80;
String path_on     = "/domotiako/Papa/Alarme/tester.php?light=on";
String path         ="/domotiako/Papa/Alarme/alarme.json";




int laser = 5;
int LED = 14;
int heure;
int heuredebut = 19; // heure GMT
int heurefin = 2; // heure GMT

//int heuredebut = 6; // heure GMT
//int heurefin = 10; // heure GMT

String previous = "off";
String actuel = "off";

void setup() {

  pinMode(laser, OUTPUT);
  pinMode(LED,OUTPUT);
  digitalWrite(LED,LOW);
  

  Serial.begin(115200);

  reconfiguration_init();
  
  Serial.println("Connected to wifi");


}

void loop() {

//############ RAJOUT ############

//if (digitalRead(CONFIG_PIN) == 0) {
//  //reconfiguration();
//  ESP.restart();
//}

duree = bouton.dureeEnfonce();
    bouton.actualiser();
    
  if (bouton.vientDEtreEnfonce()){
  Serial.print("Bouton enfonce");
  }


    if (bouton.vientDEtreRelache()) {
      if (duree >= 0 && duree < 5000) {
        ESP.restart();
    }
      if (duree>=5000) {
        reconfiguration();
      }
    }




//############ FIN RAJOUT ############


  Serial.print("connecting to ");
  Serial.println(host);
  WiFiClient client;
  
  if (!client.connect(host, httpPort2)) {
    Serial.println("connection failed");
    return;
  }
  else {
    Serial.println("Connected to host");
  }


///////////////////

while (client.connected()) {

  client.print(String("GET ") + path + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Cache-Control: no-cache\r\n" +
               "Connection: keep-alive\r\n\r\n");
  //"Connection: close\r\n\r\n");

  delay(50); // wait for server to respond

  // read response
  String section = "header";
  //String section = "json";
  while (client.available()) {
    String line = client.readStringUntil('\r');
    //Serial.println(line);
    // we’ll parse the HTML body here
    if (section == "header") { // headers..
      Serial.print(".");
      delay(50);
      if (line == "\n") { // skips the empty space at the beginning
        section = "json";
      }
    }
    else if (section == "json") { // print the good stuff
      section = "ignore";
      String result = line.substring(1);

      // Parse JSON
      int size = result.length() + 1;
      char json[size];
      result.toCharArray(json, size);
      StaticJsonBuffer<200> jsonBuffer;
      JsonObject& json_parsed = jsonBuffer.parseObject(json);
      if (!json_parsed.success())
      {
        Serial.println("parseObject() failed");
        return;
      }

      // Make the decision to turn off or on the LED
      if (strcmp(json_parsed["alarme"], "marche") == 0) {

//////////////

    delay(2000);


  digitalWrite(laser,LOW); 

       
    
 // }

      }
      else {
      delay(3000);
  digitalWrite(laser,HIGH);
  Serial.println("laser,HIGH");
      } 
      }
}
}
delay(50);
}

//#######################DEBUT ###################"
void reconfiguration_init(){
  if (WiFi.psk() != "") {
  Serial.print("wifi password : ");
  Serial.println(WiFi.psk());
  WiFi.begin();
  delay(5000);
    if (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print("wifi connection problem... going to portal");
    reconfiguration();
  }
} else {
  Serial.println("no wifi config ; starting portal...");
  reconfiguration();
}
}



void reconfiguration(){
// put your setup code here, to run once:
    Serial.begin(115200);
 
    //WiFiManager
    //Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wifiManager;
    //reset saved settings
    wifiManager.resetSettings();
    
    //set custom ip for portal
    wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
 
    //fetches ssid and pass from eeprom and tries to connect
    //if it does not connect it starts an access point with the specified name
    //here  "AutoConnectAP"
    //and goes into a blocking loop awaiting configuration
    wifiManager.autoConnect("AutoConnectAPEmetteur");
    //or use this for auto generated name ESP + ChipID
    //wifiManager.autoConnect();
 
    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");


}

//####################### FIN ###################"

Originally created by @randoniaina on GitHub (Dec 20, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/792 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [x ] Master - [ ] Development **Esp8266/Esp32:** - [x ] ESP8266 - [ ] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [x ] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other **ESP Core Version: 2.4.0, staging** - [ x] 2.3.0 - [ ] 2.4.0 - [ ] staging (master/dev) ### Description Hello everyone, I do face a very weird situation. I have 2 ESP8266 12e. - One that I worked on early 2018, on which I have Wifimanager library (don't remember the version since I upgrade this version since then). = > this board is connected to a wifi router - Two other boards on which I've bee working for 2 months and on which there are Wifimanager library also (version 0.14.0) = > These 2 boards are also connected to the SAME WIFI ROUTER. The problem is that the last 2 boards launch the config portal randomly (for an unknown reason) : the Wifi routeur is always on WHEREAS the former board (on which I worked on early 2018) does NOT launch the config portal randomly. The expected behaviour would be the 1st behaviour (that on the former board). Can someone please help ? I cannot figure it out. Here the code of the older board ``` #include <ArduinoJson.h> #include <ESP8266WiFi.h> #include <WiFiClient.h> //needed for library #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> /* Measuring AC Current Using ACS712 */ const double sensorIn = A0; int LED_PIN = 4; int CONFIG_PIN = 12; int statut_relay_actuel; int statut_relay_avant; int statut_line; int mVperAmp = 30; // use 100 for 20A Module and 66 for 30A Module double Voltage = 0; double VRMS = 0; double AmpsRMS = 0; //const char *ssid = "DLINKAP"; //const char *password = "Disney"; const char* host = "mydomain.com"; // Your domain String path_relay = "/Papa/Light/relay.json"; String path_relay_off = "/Papa/Light/tester_relay.php?relay=off"; String path_on = "/Papa/Light/tester.php?light=on"; String path_off = "/Papa/Light/tester.php?light=off"; WiFiClient client; void setup(){ Serial.begin(115200); pinMode(LED_PIN, OUTPUT); //GPIO05 is an OUTPUT pin; reconfiguration_init(); if (digitalRead(CONFIG_PIN) == 0) { ESP.restart(); } } void loop(){ //############ RAJOUT ############ if (digitalRead(CONFIG_PIN) == 0) { //reconfiguration(); ESP.restart(); } //############ FIN RAJOUT ############ Serial.print("connecting to "); Serial.println(host); const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; } client.print(String("GET ") + path_relay + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Cache-Control: no-cache\r\n" + "Connection: keep-alive\r\n\r\n"); delay(500); // wait for server to respond // read response String section = "header"; while (client.available()) { String line = client.readStringUntil('\r'); // Serial.print(line); // we’ll parse the HTML body here if (section == "header") { // headers.. Serial.print("."); if (line == "\n") { // skips the empty space at the beginning section = "json"; } } else if (section == "json") { // print the good stuff section = "ignore"; String result = line.substring(1); // Parse JSON int size = result.length() + 1; char json[size]; result.toCharArray(json, size); StaticJsonBuffer<200> jsonBuffer; JsonObject& json_parsed = jsonBuffer.parseObject(json); if (!json_parsed.success()) { Serial.println("parseObject() failed"); return; } // Make the decision to turn off or on the LED if (strcmp(json_parsed["relay"], "on") == 0) { switch_inter(); } } } //--------------------Traitement statut sur internet--------------------- Voltage = getVPP(); VRMS = (Voltage/2.0) *0.707; AmpsRMS = (VRMS * 1000)/mVperAmp; if (AmpsRMS > 1) { signal_allume(); } else { signal_eteint(); } Serial.print(AmpsRMS); Serial.println(" Amps RMS"); } float getVPP() { float result; double readValue; //value read from the sensor int maxValue = 0; // store max value here int minValue = 1024; // store min value here uint32_t start_time = millis(); while((millis()-start_time) < 1000) //sample for 1 Sec { readValue = analogRead(sensorIn); //Serial.print("A0 == "); //Serial.println(readValue); // see if you have a new maxValue if (readValue > maxValue) { /*record the maximum sensor value*/ maxValue = readValue; } if (readValue < minValue) { /*record the maximum sensor value*/ minValue = readValue; } } // Subtract min from max result = ((maxValue - minValue) * 5.0)/1024.0; return result; } void signal_allume(){ statut_line = HIGH; Serial.print("connecting to "); Serial.println(host); WiFiClient client; client.stop(); const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; } //client.stop(); client.print(String("GET ") + path_on + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Cache-Control: no-cache\r\n" + //"Connection: keep-alive\r\n\r\n"); "Connection: close\r\n\r\n"); //digitalWrite(LED_PIN, HIGH); //delay(2000); //digitalWrite(LED_PIN, LOW); //delay(500); //digitalWrite(LED_PIN, HIGH); //delay(2000); //digitalWrite(LED_PIN, HIGH); delay(100); //statut = "allume"; } void signal_eteint(){ statut_line = LOW; Serial.print("connecting to "); Serial.println(host); WiFiClient client; client.stop(); const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; } //client.stop(); client.print(String("GET ") + path_off + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Cache-Control: no-cache\r\n" + //"Connection: keep-alive\r\n\r\n"); "Connection: close\r\n\r\n"); //digitalWrite(LED_PIN, LOW); delay(100); //statut = "eteint"; } void switch_inter() { WiFiClient client; client.stop(); const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; } if (statut_relay_avant == LOW) { digitalWrite(LED_PIN, HIGH); statut_relay_avant = HIGH; } else { digitalWrite(LED_PIN, LOW); statut_relay_avant = LOW; } client.print(String("GET ") + path_relay_off + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Cache-Control: no-cache\r\n" + //"Connection: keep-alive\r\n\r\n"); "Connection: close\r\n\r\n"); delay(100); } void reconfiguration_init(){ if (WiFi.psk() != "") { Serial.print("wifi password : "); Serial.println(WiFi.psk()); WiFi.begin(); delay(5000); if (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("wifi connection problem... going to portal"); reconfiguration(); } } else { Serial.println("no wifi config ; starting portal..."); reconfiguration(); } } //#######################DEBUT ###################" void reconfiguration(){ // put your setup code here, to run once: Serial.begin(115200); //WiFiManager //Local intialization. Once its business is done, there is no need to keep it around WiFiManager wifiManager; //reset saved settings wifiManager.resetSettings(); //set custom ip for portal wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); //fetches ssid and pass from eeprom and tries to connect //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration wifiManager.autoConnect("AutoConnectAP"); //or use this for auto generated name ESP + ChipID //wifiManager.autoConnect(); //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } //####################### FIN ###################" ``` and this is the code on one of the latter board : ``` #include <ArduinoJson.h> #include <ESP8266WiFi.h> #include <WiFiClient.h> //needed for library #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> #include <simpleBouton.h> simpleBouton bouton(12); uint32_t duree ; char serverName[] = "api.pushetta.com"; boolean lastConnected = false; int status = WL_IDLE_STATUS; const char *ssid = "DLINKAP"; const char *pass = "Katarina_01"; const char* host = "ccm-lhta.net"; // Your domain const int httpPort2 = 80; String path_on = "/domotiako/Papa/Alarme/tester.php?light=on"; String path ="/domotiako/Papa/Alarme/alarme.json"; int laser = 5; int LED = 14; int heure; int heuredebut = 19; // heure GMT int heurefin = 2; // heure GMT //int heuredebut = 6; // heure GMT //int heurefin = 10; // heure GMT String previous = "off"; String actuel = "off"; void setup() { pinMode(laser, OUTPUT); pinMode(LED,OUTPUT); digitalWrite(LED,LOW); Serial.begin(115200); reconfiguration_init(); Serial.println("Connected to wifi"); } void loop() { //############ RAJOUT ############ //if (digitalRead(CONFIG_PIN) == 0) { // //reconfiguration(); // ESP.restart(); //} duree = bouton.dureeEnfonce(); bouton.actualiser(); if (bouton.vientDEtreEnfonce()){ Serial.print("Bouton enfonce"); } if (bouton.vientDEtreRelache()) { if (duree >= 0 && duree < 5000) { ESP.restart(); } if (duree>=5000) { reconfiguration(); } } //############ FIN RAJOUT ############ Serial.print("connecting to "); Serial.println(host); WiFiClient client; if (!client.connect(host, httpPort2)) { Serial.println("connection failed"); return; } else { Serial.println("Connected to host"); } /////////////////// while (client.connected()) { client.print(String("GET ") + path + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Cache-Control: no-cache\r\n" + "Connection: keep-alive\r\n\r\n"); //"Connection: close\r\n\r\n"); delay(50); // wait for server to respond // read response String section = "header"; //String section = "json"; while (client.available()) { String line = client.readStringUntil('\r'); //Serial.println(line); // we’ll parse the HTML body here if (section == "header") { // headers.. Serial.print("."); delay(50); if (line == "\n") { // skips the empty space at the beginning section = "json"; } } else if (section == "json") { // print the good stuff section = "ignore"; String result = line.substring(1); // Parse JSON int size = result.length() + 1; char json[size]; result.toCharArray(json, size); StaticJsonBuffer<200> jsonBuffer; JsonObject& json_parsed = jsonBuffer.parseObject(json); if (!json_parsed.success()) { Serial.println("parseObject() failed"); return; } // Make the decision to turn off or on the LED if (strcmp(json_parsed["alarme"], "marche") == 0) { ////////////// delay(2000); digitalWrite(laser,LOW); // } } else { delay(3000); digitalWrite(laser,HIGH); Serial.println("laser,HIGH"); } } } } delay(50); } //#######################DEBUT ###################" void reconfiguration_init(){ if (WiFi.psk() != "") { Serial.print("wifi password : "); Serial.println(WiFi.psk()); WiFi.begin(); delay(5000); if (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("wifi connection problem... going to portal"); reconfiguration(); } } else { Serial.println("no wifi config ; starting portal..."); reconfiguration(); } } void reconfiguration(){ // put your setup code here, to run once: Serial.begin(115200); //WiFiManager //Local intialization. Once its business is done, there is no need to keep it around WiFiManager wifiManager; //reset saved settings wifiManager.resetSettings(); //set custom ip for portal wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); //fetches ssid and pass from eeprom and tries to connect //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration wifiManager.autoConnect("AutoConnectAPEmetteur"); //or use this for auto generated name ESP + ChipID //wifiManager.autoConnect(); //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } //####################### FIN ###################" ```
Author
Owner

@tablatronix commented on GitHub (Dec 20, 2018):

have you erased the flash ?

<!-- gh-comment-id:449103287 --> @tablatronix commented on GitHub (Dec 20, 2018): have you erased the flash ?
Author
Owner

@randoniaina commented on GitHub (Dec 20, 2018):

Yes I did every time I upload a sketch I tick "erase all flash" on the ide config. Then I enter the portalconfig and select the wifi router. 

-------- Message d'origine --------De : Shawn A notifications@github.com Date : 20/12/2018 22:06 (GMT+03:00) À : tzapu/WiFiManager WiFiManager@noreply.github.com Cc : randoniaina andoniainarajaona@gmail.com, Author author@noreply.github.com Objet : Re: [tzapu/WiFiManager] Different behaviour Wifimanager on 2 different ESP8266 12E (#792)
have you erased the flash ?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/tzapu/WiFiManager","title":"tzapu/WiFiManager","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/tzapu/WiFiManager"}},"updates":{"snippets":[{"icon":"PERSON","message":"@tablatronix in #792: have you erased the flash ?"}],"action":{"name":"View Issue","url":"https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287"}}}
[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287",
"url": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]

<!-- gh-comment-id:449107853 --> @randoniaina commented on GitHub (Dec 20, 2018): Yes I did every time I upload a sketch I tick "erase all flash" on the ide config. Then I enter the portalconfig and select the wifi router.  -------- Message d'origine --------De : Shawn A <notifications@github.com> Date : 20/12/2018 22:06 (GMT+03:00) À : tzapu/WiFiManager <WiFiManager@noreply.github.com> Cc : randoniaina <andoniainarajaona@gmail.com>, Author <author@noreply.github.com> Objet : Re: [tzapu/WiFiManager] Different behaviour Wifimanager on 2 different ESP8266 12E (#792) have you erased the flash ? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/tzapu/WiFiManager","title":"tzapu/WiFiManager","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/tzapu/WiFiManager"}},"updates":{"snippets":[{"icon":"PERSON","message":"@tablatronix in #792: have you erased the flash ?"}],"action":{"name":"View Issue","url":"https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287", "url": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Author
Owner

@randoniaina commented on GitHub (Dec 20, 2018):

What should I do if I want the following behaviour :- let the esp try to Connect to the wifi routeur even if it fails (do not let the esp open the portalconfig) - open the the portalconfig only and only if I push a button
Regards 

-------- Message d'origine --------De : Shawn A notifications@github.com Date : 20/12/2018 22:06 (GMT+03:00) À : tzapu/WiFiManager WiFiManager@noreply.github.com Cc : randoniaina andoniainarajaona@gmail.com, Author author@noreply.github.com Objet : Re: [tzapu/WiFiManager] Different behaviour Wifimanager on 2 different ESP8266 12E (#792)
have you erased the flash ?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/tzapu/WiFiManager","title":"tzapu/WiFiManager","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/tzapu/WiFiManager"}},"updates":{"snippets":[{"icon":"PERSON","message":"@tablatronix in #792: have you erased the flash ?"}],"action":{"name":"View Issue","url":"https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287"}}}
[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287",
"url": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]

<!-- gh-comment-id:449111449 --> @randoniaina commented on GitHub (Dec 20, 2018): What should I do if I want the following behaviour :- let the esp try to Connect to the wifi routeur even if it fails (do not let the esp open the portalconfig) - open the the portalconfig only and only if I push a button Regards  -------- Message d'origine --------De : Shawn A <notifications@github.com> Date : 20/12/2018 22:06 (GMT+03:00) À : tzapu/WiFiManager <WiFiManager@noreply.github.com> Cc : randoniaina <andoniainarajaona@gmail.com>, Author <author@noreply.github.com> Objet : Re: [tzapu/WiFiManager] Different behaviour Wifimanager on 2 different ESP8266 12E (#792) have you erased the flash ? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/tzapu/WiFiManager","title":"tzapu/WiFiManager","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/tzapu/WiFiManager"}},"updates":{"snippets":[{"icon":"PERSON","message":"@tablatronix in #792: have you erased the flash ?"}],"action":{"name":"View Issue","url":"https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287", "url": "https://github.com/tzapu/WiFiManager/issues/792#issuecomment-449103287", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Author
Owner

@tablatronix commented on GitHub (Dec 20, 2018):

dont use autoconnect()

<!-- gh-comment-id:449115086 --> @tablatronix commented on GitHub (Dec 20, 2018): dont use autoconnect()
Author
Owner

@tablatronix commented on GitHub (Dec 20, 2018):

Is it possible you have wore out the flash ram by writing too many times?

<!-- gh-comment-id:449115389 --> @tablatronix commented on GitHub (Dec 20, 2018): Is it possible you have wore out the flash ram by writing too many times?
Author
Owner

@randoniaina commented on GitHub (Dec 21, 2018):

No cause this behaviour started happening despite the board was New. 
Can you confirm one thing ? Autoconnect is about connecting to a wifi routeur, Nothing to do with either or not there is internet provided by the wifi routeur, is that correct ? 
Cause sometimes even if the routeur is on, there is internet connection problem. 
Regards 

Envoyé depuis mon smartphone Samsung Galaxy.
-------- Message d'origine --------De : Shawn A notifications@github.com Date : 20/12/2018 22:48 (GMT+03:00) À : tzapu/WiFiManager WiFiManager@noreply.github.com Cc : randoniaina andoniainarajaona@gmail.com, Author author@noreply.github.com Objet : Re: [tzapu/WiFiManager] Different behaviour Wifimanager on 2 different ESP8266 12E (#792)
Is it possible you have wore out the flash ram by writing too many times?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<!-- gh-comment-id:449230123 --> @randoniaina commented on GitHub (Dec 21, 2018): No cause this behaviour started happening despite the board was New.  Can you confirm one thing ? Autoconnect is about connecting to a wifi routeur, Nothing to do with either or not there is internet provided by the wifi routeur, is that correct ?  Cause sometimes even if the routeur is on, there is internet connection problem.  Regards  Envoyé depuis mon smartphone Samsung Galaxy. -------- Message d'origine --------De : Shawn A <notifications@github.com> Date : 20/12/2018 22:48 (GMT+03:00) À : tzapu/WiFiManager <WiFiManager@noreply.github.com> Cc : randoniaina <andoniainarajaona@gmail.com>, Author <author@noreply.github.com> Objet : Re: [tzapu/WiFiManager] Different behaviour Wifimanager on 2 different ESP8266 12E (#792) Is it possible you have wore out the flash ram by writing too many times? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Author
Owner

@tablatronix commented on GitHub (Dec 21, 2018):

yeah sounds like something with the router I think there is some kind of problem disconnecting and reconnecting perhaps, the only thing I can think of is increase connecttimeout, or add your own loop ir delay and see if it fixes by letting the router reset the lost connections.

Have you checked to make sure your esp is not wdt reseting, causing these resets

Have you tried disabling sleep
WiFi.setSleepMode(WIFI_NONE_SLEEP); // disable wifi sleep

<!-- gh-comment-id:449403394 --> @tablatronix commented on GitHub (Dec 21, 2018): yeah sounds like something with the router I think there is some kind of problem disconnecting and reconnecting perhaps, the only thing I can think of is increase connecttimeout, or add your own loop ir delay and see if it fixes by letting the router reset the lost connections. Have you checked to make sure your esp is not wdt reseting, causing these resets Have you tried disabling sleep `WiFi.setSleepMode(WIFI_NONE_SLEEP); // disable wifi sleep`
Author
Owner

@randoniaina commented on GitHub (Dec 22, 2018):

Seems like the router sometimes has some pblms assigning ip addresses. But the weird part is why the old board is not portalconfig showing whereas the newer ones are ? 

Envoyé depuis mon appareil mobile Samsung.
null

<!-- gh-comment-id:449568352 --> @randoniaina commented on GitHub (Dec 22, 2018): Seems like the router sometimes has some pblms assigning ip addresses. But the weird part is why the old board is not portalconfig showing whereas the newer ones are ?  Envoyé depuis mon appareil mobile Samsung. null
Author
Owner

@randoniaina commented on GitHub (Dec 22, 2018):

What is wifi sleep mode ? How to check the wdt reset or not ? 
Tx in advance 

Envoyé depuis mon appareil mobile Samsung.
null

<!-- gh-comment-id:449568616 --> @randoniaina commented on GitHub (Dec 22, 2018): What is wifi sleep mode ? How to check the wdt reset or not ?  Tx in advance  Envoyé depuis mon appareil mobile Samsung. null
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#662
No description provided.