tzapu / WiFiManager

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

ESP8266 does not reconnect after exiting promiscuous mode #544

Open kubark42 opened 6 years ago

kubark42 commented 6 years ago

Basic Infos

Hardware

WiFimanager Branch/Release: 0.12.0

Hardware: Huzzah

Core Version: 2.4.0

Description

When promiscuous mode is turned on and then off, WifiManager will no longer connect.

Settings in IDE

Module: Huzzah ESP8266

Sketch

#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino

//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>         //https://github.com/tzapu/WiFiManager

WiFiManager wifiManager;

void setup() {
  // put your setup code here, to run once:
  Serial1.begin(115200);
  Serial1.setDebugOutput(true); // Turn on WIFI debug info

  wifiManager.autoConnect("ssid", "password");

  //if you get here you have connected to the WiFi
  Serial1.println("connected...yeey :)");
}

void loop() {
  enableWifiMonitorMode();
  Serial1.print("before (ms): ");
  Serial1.println(millis());
  enableWifiClient();
  Serial1.print("after (ms): ");
  Serial1.println(millis());
}

void enableWifiMonitorMode()
{
  // Send ESP into promiscuous mode. At this point, it stops being able to connect to the internet
  Serial1.println("Turning on wifi monitoring.");
  //    wifi_set_opmode(WIFI_STA);
  wifi_set_promiscuous_rx_cb(receiveWifiSniff_cb);
  wifi_promiscuous_enable(true);
}

void enableWifiClient()
{
  // Send ESP into promiscuous mode. At this point, it stops being able to connect to the internet
  Serial1.println("Turning off wifi monitoring.");
  wifi_promiscuous_enable(false);

  if (!wifiManager.autoConnect("ssid", "password")) {
    Serial1.println("failed to connect, timed out...");
  }

}

void receiveWifiSniff_cb(uint8_t *buf, uint16 len)
{
}

Debug Messages

rscandone
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with SSID, channel 1
dhcp client start...
ip:192.168.86.109,mask:255.255.255.0,gw:192.168.86.1
connected...yeey :)
Turning on wifi monitoring.
state: 5 -> 0 (0)
rm 0
before(ms): 4158
Turning off wifi monitoring.
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with SSID, channel 1
dhcp client start...
pm open,type:2 0
tablatronix commented 6 years ago

Try deveopment, master is not supported

henriquebol commented 6 years ago

Same problem here. Did you find a solution?