Closed RogerSchaefer closed 6 years ago
Will you post your sketch? I can try reproducing that issue.
"Millis ()" is strange? Value of ADC was also been 20 - 30 points lower.
Hi igrr, The code is below; hope it helps. Roger /////////////////////////////////////////// // my dashboard // https://io.adafruit.com/Oldmicroguy/ // /*** Adafruit MQTT Library ESP8266 Example
Must use ESP8266 Arduino from: https://github.com/esp8266/Arduino
Works great with Adafruit's Huzzah ESP board & Feather ----> https://www.adafruit.com/product/2471 ----> https://www.adafruit.com/products/2821
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Tony DiCola for Adafruit Industries. MIT license, all text above must be included in any redistribution ****/
//////////////////////////// // pick one test device // // //
////////////////////////////
//#define PULLUP true //#define INVERT true //#define DEBOUNCE_MS 100 //#define SINK false
/***** WiFi Access Point *****/
/***** Adafruit.io Setup *****/
/\ Global State (you don't need to change this!) ****/
// Create an ESP8266 WiFiClient class to connect to the MQTT server. WiFiClient client; // or... use WiFiFlientSecure for SSL //WiFiClientSecure client;
// Store the MQTT server, username, and password in flash memory. // This is required for using the Adafruit MQTT library. const char MQTT_SERVER[] PROGMEM = AIO_SERVER; const char MQTT_USERNAME[] PROGMEM = AIO_USERNAME; const char MQTT_PASSWORD[] PROGMEM = AIO_KEY;
// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details. Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, AIO_SERVERPORT, MQTT_USERNAME, MQTT_PASSWORD);
/****** Feeds ***/
// Setup a feed called 'photocell' for publishing.
// Notice MQTT paths for AIO follow the form:
const char PHOTOCELL_FEED[] PROGMEM = AIO_USERNAME "/feeds/photocell"; Adafruit_MQTT_Subscribe photocell = Adafruit_MQTT_Subscribe(&mqtt, PHOTOCELL_FEED);
// Setup a feed called 'onoff' for subscribing to changes. const char ONOFF_FEED[] PROGMEM = AIO_USERNAME "/feeds/onoffbutton"; Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);
/*** Sketch Code ****/
// Bug workaround for Arduino 1.6.6, it seems to need a function declaration // for some reason (only affects ESP8266, likely an arduino-builder bug). //void MQTT_connect();
void setup() { Serial.begin(9600); delay(10); pinMode(LED_PIN, OUTPUT); // Initialize the BUILTIN_LED pin as an output pinMode(RELAY,OUTPUT); digitalWrite(RELAY, LOW); blink(5); digitalWrite(LED_PIN, LOW); Serial.println(); Serial.println(F("Adafruit MQTT demo"));
// Connect to WiFi access point. Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(WLAN_SSID);
WiFi.begin(WLAN_SSID, WLAN_PASS); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println();
Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP());
// Setup MQTT subscription for onoff feed. mqtt.subscribe(&onoffbutton); mqtt.subscribe(&photocell); } ////////// End of Setup /////////////////// /////////////////////////////////////////// uint32_t x=0;
void loop() { // Ensure the connection to the MQTT server is alive (this will make the first // connection and automatically reconnect when disconnected). See the MQTT_connect // function definition further below. MQTT_connect();
// this is our 'wait for incoming subscription packets' busy subloop // try to spend your time here
Adafruit_MQTT_Subscribe subscription; while ((subscription = mqtt.readSubscription(1000))) { // Check if its the onoff button feed if (subscription == &onoffbutton) { Serial.print(F("On-Off button: ")); Serial.println((char )onoffbutton.lastread);
if (strcmp((char *)onoffbutton.lastread, "ON") == 0) {
digitalWrite(LED_PIN, LOW);
}
if (strcmp((char *)onoffbutton.lastread, "OFF") == 0) {
digitalWrite(LED_PIN, HIGH);
}
}
if (subscription == &photocell) {
//Serial.print(F("Value "));
//Serial.println((char *)photocell.lastread);
Serial.print(F("Temperature "));
float temp = atof((char *)photocell.lastread);
Serial.print(temp, 1);
Serial.println(" F");
if (temp < 69.0) {
if (INVERT) digitalWrite(LED_PIN, HIGH); else digitalWrite(LED_PIN,LOW);
if (INVERT) digitalWrite(RELAY, HIGH); else digitalWrite(RELAY, LOW);
}
if (temp > 70.0) {
if (INVERT) digitalWrite(LED_PIN, LOW); else digitalWrite(LED_PIN,HIGH);
if (INVERT) digitalWrite(RELAY, LOW); else digitalWrite(RELAY, HIGH);
}
}
} // Now we can publish stuff! / Serial.print(F("\nSending photocell val ")); Serial.print(x); Serial.print("..."); if (! photocell.publish(x++)) { Serial.println(F("Failed")); } else { Serial.println(F("OK!")); }/ // ping the server to keep the mqtt connection alive // NOT required if you are publishing once every KEEPALIVE seconds
if(! mqtt.ping()) { mqtt.disconnect(); } } //////// End of Loop ////////////////// //////////////////////////////////////
// Function to connect and reconnect as necessary to the MQTT server. // Should be called in the loop function and it will take care if connecting. void MQTT_connect() { int8_t ret;
// Stop if already connected. if (mqtt.connected()) { return; }
Serial.print("Connecting to MQTT... ");
uint8_t retries = 3; while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected Serial.println(mqtt.connectErrorString(ret)); Serial.println("Retrying MQTT connection in 5 seconds..."); mqtt.disconnect(); delay(5000); // wait 5 seconds retries--; if (retries == 0) { // basically die and wait for WDT to reset me while (1); } } Serial.println("MQTT Connected!"); } /////////////////////////////// void blink (int i) { while (i) { digitalWrite(LED_PIN, LOW); // Turn the LED on (Note that LOW is the voltage level // but actually the LED is on) delay(250); // Wait a bit digitalWrite(LED_PIN, HIGH); // Turn the LED off by making the voltage HIGH delay(250); i--; } } ///////////////////////////////
I am using the AzureIoTHub simplesample_http. It works perfectly with 2.2, but upon grading to 2.3 I get this experience. I can connect to my router (reports assigned an IP address), but it keeps looping as though it failed and spews cryptic debugging errors.
I have same problem with it , my connection get lost sometimes but module try to reconnect to Access point , and this make me problem when using the websocket
@RogerSchaefer
I have loaded the provided sketch, changed SSID and password and connection went fine.
Could you please provide serial output when debugging is enabled?
Please set "Debug Port: Serial" and "Debug Level: Core" in Arduino Tools menu, and add Serial.setDebugOutput(true);
line after Serial.begin(9600);
. This will print some info from WiFi stack.
We had an SDK update between 2.2.0 and 2.3.0. Because SDK updates sometimes don't migrate parameter storage area in flash correctly, this can cause connection issues. Debug output can give more hints at what's happening on your side.
@zfields since this is a third party library, best we can do is help you make sense of "cryptic debugging errors" (whatever that may mean). Please feel free to open an issue, and provide the exact sketch you are running, settings you have in IDE tools menu, and full serial output. Thanks.
Hello @igrr I have attached debug files from both Ver 2.2.0 and Ver 2.3.0 The object of the sketch is to get mqtt temperature data. Ver 2.2.0 connects quickly Ver 2.3.0 sometimes after 10 or 20 minutes
Roger
Thanks for the logs, I was able to reproduce this with 2.3.0.
Apparently, with SDK 1.5.3, if you call WiFi.begin by the time WiFi connection is already established, WiFi connection state machine enters some weird state. SDK function wifi_station_get_connect_status
keeps returning STATION_CONNECTING
, even though the connection is in fact established.
This was resolved in SDK 1.5.4, which is available in current git version of ESP8266 core. I tested the same code with git version and it worked fine.
As a workaround, you can replace WiFi.begin(ssid, password);
with
if (WiFi.status() != WL_CONNECTED) {
WiFi.begin(ssid, password);
}
or with
WiFi.persistent(false);
WiFi.mode(WIFI_OFF); // this is a temporary line, to be removed after SDK update to 1.5.4
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
I will consider releasing 2.3.1 with a workaround for this issue in a couple of days.
I fact the same problem. Test on Generic ESP-01 Debug show something like not found my router (belkin.a57). Connect wifi with ESP8266WiFiMulti library.
But work fine on NodeMCU1.0 (ESP-12E Module)
***\ Resullt on ESP-01 Begin... del if0 usl mode : null mode : sta(18:fe:34:98:6a:e2) add if0 f r0, scandone f r0, scandone state: 0 -> 2 (b0) state: 2 -> 0 (2) reconnect f 0, scandone state: 0 -> 2 (b0) state: 2 -> 0 (2) reconnect f -180, scandone no belkin.a57 found, reconnect after 1s f r0, scandone f r0, scandone state: 0 -> 2 (b0) state: 2 -> 0 (2) reconnect f 0, scandone state: 0 -> 2 (b0) state: 2 -> 0 (2) reconnect f -180, scandone no belkin.a57 found, reconnect after 1s
// ***\ Below is result on NodeMCU1.0 (ESP-12E Module) Begin... scandone f r0, scandone f r0, scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 7 cnt
connected with belkin.a57, channel 6 dhcp client start... ip:192.168.1.11,mask:255.255.255.0,gw:192.168.1.1 please start sntp first ! [8][192.168.1.11] GET payload: {"D1":"ON","SW1":"\"OFF\""} D1 = ON
@SupotSaeEa doesn't look like the same issue to me, because there are reconnect attempts visible in the log. Please check that you are setting correct flash size when compiling for you ESP-01 module. Usually they have smaller flash size than NodeMCU (512k or 1M).
@igrr I add WiFi.setOutputPower(0); ESP-01 is work on 2.3.0.
@SupotSaeEa's workaround seems to fix the issue for the ESP03 as well.
WiFi.setOutputPower(0);
WiFi.begin(ssid, password);
I can also confirm the settings are correctly set on the IDE for the module, checked every time I compiled. I tried checking with the older versions (2.0.0 - 2.2.0) but apparently I can't compile with them. Keeps throwing the following:
Uploading 227872 bytes from to flash at 0x00000000
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
error: espcomm_upload_mem failed
I'd like to reiterate that it works perfectly fine with the 2.3.0 package, just needs the workaround mentioned.
I have the same problem on ESP-12 Lolin (Arduino 1.6.8). Reset ESP-12 , WiFI.begin() and WiFi.status() != WL_CONNECTED waits forever. Only repower the WIFI router help me.
This solves the problem fine.
WiFi.persistent(false);
WiFi.mode(WIFI_OFF);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Thanks iggr.
This may or may not be the same bug, but I'm using the Arduino IDE, and an Adafruit Huzzah, and the sketch I have works fine (Wifi.begin works fine and connects), until I upgrade the board from 2.1.0 to either 2.2.0 or 2.3.0 - in both cases, it no longer connects.
Also, neither of the two fixes (output power to zero, nor mode to WIFI_OFF) as shown above works (but maybe they only work when using lua?).
I haven't used the lua system, so for the moment this is only so helpful, but wanted to see if this sounds like the same bug, or a different bug, before I get too far.
Thanks!
I still confirm on solution to set output power to zero. Especially on ESP-01.
Supot Sae-Ea สุพจน์ แซ่เอีย 081-454-0853
2016-10-08 8:54 GMT+07:00 CapnNemo notifications@github.com:
This may or may not be the same bug, but I'm using the Arduino IDE, and an Adafruit Huzzah, and the sketch I have works fine (Wifi.begin works fine and connects), until I upgrade the board from 2.1.0 to either 2.2.0 or 2.3.0 - in both cases, it no longer connects.
Also, neither of the two fixes (output power to zero, nor mode to WIFI_OFF) as shown above works (but maybe they only work when using lua?).
I haven't used the lua system, so for the moment this is only so helpful, but wanted to see if this sounds like the same bug, or a different bug, before I get too far.
Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esp8266/Arduino/issues/2186#issuecomment-252395369, or mute the thread https://github.com/notifications/unsubscribe-auth/AED2PWyrQQ5sxg8UkNgsIn3WjSPRuJ_Iks5qxve_gaJpZM4I9d2q .
Just to chime in with my own observations... I have been getting this bug also. Sometimes it is random, but happens the first time I try connecting a new ESP module 100% of the time with my sketch. If I upload the wificlientbasic sketch and it connects I can then upload my own sketch and it can then connect to my AP. I also find I cannot connect if I had just previously put the ESP module into AP mode. So then I have to do the "reset" as I just described.
Edit: tried the suggestions above and did not work:
WiFi.persistent(false);
WiFi.mode(WIFI_OFF);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Debug spits out chg_A2:-40 during attempts to connect.
i had that problem too !!! i fixed it with:
if (WiFi.status() != WL_CONNECTED) { // FIX FOR USING 2.3.0 CORE (only .begin if not connected)
WiFi.begin(ssid, password); // connect to the network
}
for ( count = 0; count < 20 ; count++ ) {
delay(500);
wifi_stat = WiFi.status();
Serial.print( count ); Serial.print( " WifiStat: " );
Serial.println( wifi_stat );
if ( wifi_stat == WL_CONNECTED ) {
break;
}
}
Serial.println("");
if ( count < 20 ) {
Serial.println("WiFi connected");
}else{
Serial.println("Client !!!NOT!!! connected");
// create a SoftAP for access
WiFi.softAP(ESPssid, ESPpassword);
// etc..........
}
I have the same issue. I'm using an Adafruit HUZZAH ESP8266 with ESP8266Scheduler. WiFi.begin() doesn't work after uploading the code and WiFi.begin has previously been ran. I have to press the RST switch on the HUZZAH, sometimes it fixes the problem(depends if wifi.begin is in setup() or somewhere else). But the only way to always fix the problem is to reconnect the USB cable
I have been having similar looking issues with my NodeMCU (using Arduino) boards. Very close to my AP, they connect to Wifi without issue, but move them 25 feet away and down one floor, and the initial "connect" takes minutes sometimes.
Finally tracked it down to DHCP. The actual connection to the SSID takes maybe a second or less, but then it gets hung up on DHCP. I suspect the internal RTOS isn't allowing sufficient time-outs for DHCP messages and gets it all wrong somehow.
Switching to Static IPs fixes everything for me here. The board connects and is ready on Wifi within a second or three of power up now, regardless of distance from the AP.
if (WiFi.status() != WL_CONNECTED) { WiFi.begin(ssid, password); }
Worked for me. Thanks
Hello, I am having the same issue. Adafruit feather huzzah ESP8266 is not connecting to wifi. It used to connect but now it is stuck at the connecting step.
The code that I am using now is 2.1.0, however I've tried with 2.2 and 2.3.
This is the code I am using:
void setup() {
//start the serial line for debugging Serial.begin(9600); Serial.setDebugOutput(true);
//start wifi subsystem WiFi.disconnect(); WiFi.persistent(false); WiFi.mode(WIFI_OFF); WiFi.mode(WIFI_STA); WiFi.setOutputPower(0); //WiFi.begin(ssid, password); //WiFi.config(ip,gateway,subnet); //attempt to connect to the WIFI network and then connect to the MQTT server reconnect(); //wait a bit before starting the main loop //delay(2000); }
void reconnect() {
//attempt to connect to the wifi if connection is lost if(WiFi.status() != WL_CONNECTED){ //debug printing Serial.print("Connecting to "); Serial.println(ssid);
//loop while we wait for connection
while (WiFi.status() != WL_CONNECTED) {
WiFi.begin(ssid, password);
Serial.print(".");
delay(500);
}
//print out some more debug once connected
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
} }
From the serial monitor I can see these messages:
f r0, ..0�~?�4�!�{�OAa�bcn 0 del if1 del if0 usl mode : null mode : sta(5c:cf:7f:00:6b:cc) add if0 Connecting to Apartamentos villa f r0, .....scandone no Apartamentos villa found, reconnect after 1s reconnect f 0, ....scandone no Apartamentos villa found, reconnect after 1s reconnect f -180, .....scandone
I've been thinking to reflash the ESP.
Any suggestions?
Thank you.
Hi all,
Is there any update on this issue? I am experiencing the same problems... the wemos doesn't seem to connect to the WiFi. This is my debug output:
Connecting to: FlyingDutchmen del if0 usl mode : null mode : sta(60:01:94:33:00:c0) add if0 ...scandone state: 0 -> 2 (b0) ..state: 2 -> 0 (2) reconnect ...scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt ......state: 5 -> 2 (2a0) rm 0 .reconnect state: 2 -> 0 (0) scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt ......state: 5 -> 2 (2a0) rm 0 ..reconnect state: 2 -> 0 (0) scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt .....state: 5 -> 2 (2a0)
I had the same problem...It works fine to me:
WiFi.mode(WIFI_OFF); //workaround WiFi.mode(WIFI_AP_STA); WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
If you don't want to loose connection of the ESP8266 AP, you can use:
WiFi.mode(WIFI_AP); // workaround
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
Works with NodeMCU 1.0 and esp8266 v2.4
I will confirm that the bug exists for me as well on a NodeMCU 1.0, using the Arduino IDE with the esp8266 board library installed.
I used this workaround suggested by @igrr and it is working now:
WiFi.persistent(false);
WiFi.mode(WIFI_OFF); // this is a temporary line, to be removed after SDK update to 1.5.4
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
I've had the same intermittent problem with several NodeMCU v0.9 and v1.0 units. This code fixed it for me. Thanks to all that contribute!
#include <ESP8266WiFi.h>
const char* ssid = "YOUR-SSID";
const char* password = "YOUR-SSID-PASS";
void setup (){
Serial.begin(115200);
delay(3000);
Serial.print("Connecting to ");
Serial.println(ssid);
Serial.println(password);
// ---------------This was the magic WiFi reconnect fix for me
WiFi.persistent(false);
WiFi.mode(WIFI_OFF); // this is a temporary line, to be removed after SDK update to 1.5.4
WiFi.mode(WIFI_STA);
// ---------------END - WiFi reconnect fix
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
Serial.println(WiFi.localIP());
}
void loop() {
}
I had a issue where, when ESP is assigned static IP from the router, it would connect to AP but fail to obtain IP. Router: Dlink DIR-600M Arduino Firmware: 2.4.1
The issue was persistent in lwIP v2.0 Higher Bandwidth and Low Memory. Changing lwIP variant to "v1.4 Higher Bandwidth" solves the issue, does not matter if you WiFi.persistent(false);
@luffykesh This is a bug in 2.4.1 fixed in latest git version.
@d-a-v Thank you. The git version does fix the issue with lwIP v2 of not connecting, but the connection(DHCP) time sometimes is around 15-20 seconds or more, whereas lwIP v1.4 establishes connection in 8-10 seconds. Again, IP assigned static from router.
IP assigned static from router.
Beeing more specific, in STA mode, getting address by DHCP server (no static IP address in the sketch), you are observing twice more delay with lwip-v2 than with lwip-v1.4 ?
@d-a-v
you are observing twice more delay with lwip-v2 than with lwip-v1.4 ?
Yes.
@d-a-v I have again encountered the issue. I have tried on both esp8266-12E and esp8266-12S with the git version, with lwIP v2, but cannot connect to the station. lwIP v1.4 works with both git version and when installed from Arduino's board manager.
@luffykesh
Regarding connection delay, I played with the interactive
sketch that you can find in File>examples>esp8266> and I noticed no much difference between the two versions of lwIP.
Regarding the connection issue you have, we need you to open a new issue describing the most accurately possible, by filling the issue template, what you are facing.
Hi alltogether, is there already an official bug fix? I encounter connection problems too. I have the WEMOS D1 mini (with ESP8266MOD (so I think also called ESP12E)) and a WEMOS NodeMcu V3 of LoLin. I am working on IDE 1.8.4 on Ubuntu 18.04
Both refuse to connect to my router. I already flashed them a while ago, but this won't work any more. My test-sketch at the moment
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
WiFi.mode(WIFI_OFF);
delay(2000);
WiFi.mode(WIFI_AP_STA);
WiFi.hostname("DEBUG");
while (WiFi.status() != WL_CONNECTED) {
WiFi.begin("WLAN_SSID",WLAN_PWD");
delay(5000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.print("My IP: ");
Serial.println(WiFi.localIP());
delay(500);
}
void loop() {
delay(5000);
}
I also tested some sketches from here and to setPowerOutput to 0. Nothing helped.
My DebugOutput:
done
state: 0 -> 2 (b0)
..state: 2 -> 0 (2)
reconnect
......scandone
state: 0 -> 2 (b0)
..state: 2 -> 0 (2)
reconnect
......scandone
state: 0 -> 2 (b0)
..state: 2 -> 0 (2)
reconnect
.....scandone
state: 0 -> 2 (b0)
. and so on
I changed between Wifi V1.4, V2 low mem and high band. Nothing...
Any further ideas?
Thanks, Fabian
Update: I can connect to my AP of my mobile phone. It has default only WPA2 or no pwd at all. My router with configuration of 2.4 Ghz and WPA2 is not found. 2.4/5 Ghz; WPA2 is found, but won't connect
Possibly you need to turn WiFi back on again?
But this thread is mostly about being connected, then occasionally seeing your ESP disconnect after an arbitrary time.
On Sun, Jun 24, 2018, 9:47 AM fabian727 notifications@github.com wrote:
Hi alltogether, is there already an official bug fix? I encounter connection problems too. I have the WEMOS D1 mini (with ESP8266MOD (so I think also called ESP12E)) and a WEMOS NodeMcu V3 of LoLin.
Both refuse to connect to my router. I already flashed them a while ago, but this won't work any more. My test-sketch at the moment `#include
void setup() { Serial.begin(115200); Serial.setDebugOutput(true);
WiFi.mode(WIFI_OFF); delay(2000); WiFi.mode(WIFI_AP_STA); WiFi.hostname("DEBUG"); while (WiFi.status() != WL_CONNECTED) { WiFi.begin("WLAN_SSID",WLAN_PWD"); delay(5000); Serial.print("."); }
Serial.println(""); Serial.println("WiFi connected");
// Print the IP address Serial.print("My IP: "); Serial.println(WiFi.localIP());
delay(500); }
void loop() { delay(5000); }
`
I also tested some sketches from here and to setPowerOutput to 0. Nothing helped.
My DebugOutput: done state: 0 -> 2 (b0) ..state: 2 -> 0 (2) reconnect ......scandone state: 0 -> 2 (b0) ..state: 2 -> 0 (2) reconnect ......scandone state: 0 -> 2 (b0) ..state: 2 -> 0 (2) reconnect .....scandone state: 0 -> 2 (b0) . and so on
I changed between Wifi V1.4, V2 low mem and high band. Nothing...
Any further ideas?
Thanks, Fabian
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/esp8266/Arduino/issues/2186#issuecomment-399761977, or mute the thread https://github.com/notifications/unsubscribe-auth/AVpLPwbr0prMgIbNdWk3tqbbHM_gvjAtks5t_6aOgaJpZM4I9d2q .
the arbitrary time is between 0 and 0.1 ms I would say, or in other words: instantly.
I got it working: it seems the WiFi module does not support WPA. I changed my security from WPA & WPA2 to only WPA2. Now it works. I think there is a big bug in the lib
I am dealing with this issue right now and i have applied to code the given solutions. wifi.persistent(false); wifi.begin(WIFI_OFF);
So far, i tested my system under a 8W fan load, i made POST request instantly to cause the system drop from wifi because of high current consumption and it did. Then i coded esp to re-estabilish wifi connection . I tested the system for 50 times to drop it and re-estabilish, as result at the 51.th of the trial it did not re-estabilish the connection ( i have waited 15 min to be re-connected ) but it did not. So far this is the temporarly best solution. Moreoever, if there are permanent solution for this problem, could you share please ?
Thanks.
@mmaxus35 Please try latest master. Yesterday's fixes were about WiFi disconnection and reconnection.
@d-a-v Okey ' i will thank a lot 👍
@d-a-v I tried the latest version on PlatformIO and tried wifi.reconnect() yet it did not re-connected :(
as already stated I changed from WPA & WPA2 to only WPA2. This module with this flashed code worked. Now nothing works. I had to shut off and on again my router and reconfigure many devices to work again... seems to be only a lucky solution
@d-a-v , how can I use this source code to upload in my board? I got the master branch, but I don´t know how to upload this into my board.
@mmaxus35 I don't know the status of PlatformIO. The fixes mentioned above are very recent and are for the arduino core with lwIP-v2.
@fabian27 please open a new issue and fill the issue template with all details you can.
@TobiNorris Using the git master branch (all documentation's steps must be followed) or downloading the arduino core through the board manager result in the same IDE and tools. Press the Arduino IDE upload button.
To all, this thread #2186 is an old issue, about an old version of the core, fixed, solved and closed. Your issues are unrelated with the OP. Please open new issues with your specific problems.
edit: Followup to: WiFi cannot connect until a power cycle. #5527
This is still an issue in 2.5.0. Some device of mine got into a weird mode and was crashing after WiFi.begin or when using .disconnect().
I resolved it by using the following sequence (I wanted mode to be persistent, so the extra persistent commands):
WiFiMode_t prepareWiFi_m = WiFi.getMode();
WiFi.persistent(false);
if (prepareWiFi_m == 3) {
WiFi.mode(WIFI_AP);
} else {
WiFi.mode(WIFI_OFF);
}
WiFi.persistent(true);
WiFi.mode(prepareWiFi_m);
WiFi.persistent(false);
`
This is still an issue in 2.5.0. Some device of mine got into a weird mode and was crashing after WiFi.begin or when using .disconnect().
I resolved it by using the following sequence (I wanted mode to be persistent, so the extra persistent commands):
WiFiMode_t prepareWiFi_m = WiFi.getMode(); WiFi.persistent(false); if (prepareWiFi_m == 3) { WiFi.mode(WIFI_AP); } else { WiFi.mode(WIFI_OFF); } WiFi.persistent(true); WiFi.mode(prepareWiFi_m); WiFi.persistent(false); `
i agree...i'm on 2.5.0 as well...but i think i saw this problem this morning....when my thermometer stopped delivering temperature measurements...event if it's been working for more than a month without problems. (wemos d1 mini running on battery)
I was the newest addition to this issue.....after reading thru this post below is what has worked for me, my problem was more with "WiFi.status() " in getting to know if wifi was connected before switching to AP mode , the prevailing while loop with condition " (WiFi.waitForConnectResult() != WL_CONNECTED)" used to block for ever if your defined SSID was not available and would never get past it to switch to AP mode, I finally used the temp status WiFi.status() == WL_IDLE_STATUS to get past this issue:
WiFi.mode(WIFI_OFF); delay(100); WiFi.mode(WIFI_STA); WiFi.begin(WiFi.SSID(), WiFi.psk()); while (WiFi.status() == WL_IDLE_STATUS) { //When the control is out of this loop its a guarantee that //1.WiFi.status() will be equal to WL_CONNECTED if the SSID being used is available //**2.WiFi.status() will be equal to WL_CONNECT_FAILED if the SSID being used is NOT available or some other failures Serial.print("."); }
If you use Arduino you must set "erase flash" to "sketch + wifi settings". "erase flash" in board manager.
Installed the new 2.3.0 today and found that a sketch I have used for a long time will no longer cause the ESP8266 to connect with my WiFi
I reverted to version 2.2.0 and the sketch works fine.
ESP8266WiFi was the only ESP8266 include in the sketch
Roger