tzapu / WiFiManager

ESP8266 WiFi Connection manager with web captive portal
http://tzapu.com/esp8266-wifi-connection-manager-library-arduino-ide/
MIT License
6.45k stars 1.94k forks source link

Problem *wm:[ERROR] Connect to new AP Failed #1691

Open mridzkyf opened 6 months ago

mridzkyf commented 6 months ago

Hello, i have a problem with WifiManager in my ESP32 Devkit. When i want to connect my ESP32 with WiFi using AP Mode, in serial monitor always show the error like this : *wm:[ERROR] Connect to new AP Failed Im so very confused, the password that I typed in the SSID that I chose is already correct, but the AP mode is still error and cannot connect to the WiFi SSID selected. For the information, in this project i use a 2 core management and use a Menu Library, so if i want to use a WiFiManager I have to access the Wifi Manager menu on my device using the keypad. i have put a snippet program code below. I hope there is a solution to my problem, thank you!

----------------------------- Remove above -----------------------------

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32:

Hardware: ESP32 Devkit V1

Description

*wm:[ERROR] Connect to new AP Failed

Settings in IDE

Module: ESP32 Devkit Module

Additional libraries:

include

include

include

include

include

include

include

include

include

include

include

include

include

Sketch

#BEGIN
#include <Arduino.h>

void setup() {
Serial.begin(115200);
    xTaskCreatePinnedToCore(
                    Task1code,   /* Task function. */
                    "Task1",     /* name of task. */
                    40000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    0,           /* priority of the task */
                    &Task1,      /* Task handle to keep track of created task */
                    0);          /* pin task to core 0 */                  
//  delay(500); 
    xTaskCreatePinnedToCore(
                    Task2code,   /* Task function. */
                    "Task2",     /* name of task. */
                    40000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task2,      /* Task handle to keep track of created task */
                    1);          /* pin task to core 0 */                  
//  delay(500); 
}

}

void Task1code( void * pvParameters ){
  for(;;){
    wifi_ap();
    noInterrupts();
    read_data_sensor();
    sendData();
    postData();
    wifi_alert();
    interrupts();
    delay(5000);
  }
}

void Task2code( void * pvParameters ){
  menu.setupLcdWithMenu(0x27, mainMenu);
  for(;;){
       menu_act();
  } 
}

//The function below is the function that I use to run AP Mode
void wifi_con(){
  char key = keypad.getKey();
  while(key != '#'){
    currentTime = millis();
    key = keypad.getKey();
    if((currentTime - lastTime) > 4000){
    if (WiFi.status() != WL_CONNECTED){
      menu.lcd->clear();
      menu.lcd->setCursor(0,0);
      menu.lcd->print("AP Connection : ");
      menu.lcd->setCursor(0,1);
      menu.lcd->print("UserName:SAMO Device");
      menu.lcd->setCursor(0,2);
      menu.lcd->print("pass:bpmsphbersih");
//      if(on_wifi == false){
//        key = '#';
//       }
      on_wifi = true;
      wifi_ap();
    } else {
        menu.lcd->clear();
        menu.lcd->setCursor(0,0);
        menu.lcd->print("Device connected");
        menu.lcd->setCursor(0,1);
        menu.lcd->print("Wifi IP : ");
        menu.lcd->setCursor(0,2);     
        menu.lcd->print(WiFi.localIP());
        menu.lcd->setCursor(0,3);
        menu.lcd->print("Was Connected");
    }
    lastTime = currentTime;
    }
  }
    menu.back();
    menu.resetMenu();
}
//=================================================
void wifi_ap(){
  if(on_wifi){
    on_wifi = false;
    Serial.print("On Wifi Aktif");
    currentTime = millis();
//    menu.back();
//    menu.resetMenu();
    res = wm.autoConnect("SAMO Device", "bpmsphbersih");
    Serial.print(res);
    if (res){
      Serial.print("Sukses");
      const char* ssid1 = WiFi.SSID().c_str();
      const char* pass1 = WiFi.psk().c_str();
      ssid = ssid1;
      pass = pass1;
      Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
      on_wifi = false;
//      telahOn = true;
      wifi_con();
      } 
  }
}
#END

Debug Messages

*wm:[ERROR] Connect to new AP Failed 
tablatronix commented 6 months ago

More debug what reason