Open ghost opened 6 years ago
Did you try erasing the flash?
So do you think it is not saving the wifi credentials on save ?
What do the serial logs say ?
Hmmm same with the autoconnect example?
autoconnect example
code
#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
void setup() {
// 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.setAPConfig(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 :)");
}
void loop() {
// put your main code here, to run repeatedly:
}
serial logs ⸮WM: WM: AutoConnect WM: Connecting as wifi client... WM: Using last saved values, should be faster WM: Connection result: WM: 0 WM: SET AP STA WM: WM: Configuring access point... WM: AutoConnectAP WM: AP IP address: WM: 192.168.4.1 WM: HTTP server started WM: Handle root WM: Request redirected to captive portal WM: Request redirected to captive portal WM: Handle root WM: Handle root WM: Scan done WM: Pro-Syrian.com WM: -57 WM: DemirT WM: -73 WM: Emirhan WM: -84 WM: iPhone WM: -96 WM: Sent config page WM: Handle root WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Scan done WM: Pro-Syrian.com WM: -57 WM: DemirT WM: -77 WM: Emirhan WM: -87 WM: iPhone WM: -92 WM: Sent config page WM: Handle root WM: Handle root WM: Handle root WM: Scan done WM: Pro-Syrian.com WM: -58 WM: DemirT WM: -73 WM: iPhone WM: -91 WM: Sent config page WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: WiFi save WM: Sent wifi save page WM: Connecting to new AP WM: Connecting as wifi client... WM: Connection result: WM: 4 WM: Failed to connect. WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Handle root WM: WiFi save WM: Sent wifi save page WM: Connecting to new AP WM: Connecting as wifi client... WM: Already connected. Bailing out. connected...yeey :)
serial logs After separation of current
WM: AutoConnect WM: Connecting as wifi client... WM: Using last saved values, should be faster WM: Connection result: WM: 3 WM: IP Address: *WM: 192.168.1.102 connected...yeey :)
coode with blynk token
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h>
#include <Ticker.h>
Ticker ticker;
char blynk_token[33];
void tick()
{
//toggle state
int state = digitalRead(LED_BUILTIN);
digitalWrite(LED_BUILTIN, !state);
}
void configModeCallback (WiFiManager *myWiFiManager) {
ticker.attach(0.2, tick);
}
void setup()
{
Serial.begin(115200);
WiFiManagerParameter custom_blynk_token("Blynk", "blynk token", blynk_token, 33);
WiFiManager wifi;
wifi.addParameter(&custom_blynk_token);
wifi.autoConnect("Blynk");
Blynk.config(custom_blynk_token.getValue());
}
void loop()
{
Blynk.run();
}
serial
⸮WM: Adding parameter WM: Blynk WM: WM: AutoConnect WM: Connecting as wifi client... WM: Using last saved values, should be faster WM: Connection result: WM: 0 WM: SET AP STA WM: WM: Configuring access point... WM: Blynk WM: AP IP address: WM: 192.168.4.1 WM: HTTP server started WM: Handle root WM: Handle root WM: Request redirected to captive portal WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Handle root WM: Handle root WM: Handle root WM: Handle root WM: Scan done WM: Pro-Syrian.com WM: -51 WM: DemirT WM: -78 WM: Sent config page WM: Request redirected to captive portal WM: Handle root WM: Request redirected to captive portal WM: Request redirected to captive portal WM: Request redirected to captive portal WM: WiFi save WM: Parameter WM: Blynk WM: de745e5d128647da853bb17127106bf7 WM: Sent wifi save page WM: Connecting to new AP WM: Connecting as wifi client... WM: Connection result: *WM: 3 [213913]
/ )/ / _ / /_ / / / // / \/ '/ ///_, /////_\ /___/ v0.5.2 on ESP8266
[213915] Connecting to blynk-cloud.com:80 [214073] Ready (ping: 1ms).
serial logs After separation of current WM: Blynk WM: WM: AutoConnect WM: Connecting as wifi client... WM: Using last saved values, should be faster WM: Connection result: WM: 3 WM: IP Address: *WM: 192.168.1.102 [3680]
/ )/ / _ / /_ / / / // / \/ '/ ///_, /////_\ /___/ v0.5.2 on ESP8266
[3687] Connecting to blynk-cloud.com:80 [3831] Invalid auth token [8831] Connecting to blynk-cloud.com:80 [8973] Invalid auth token [13974] Connecting to blynk-cloud.com:80 [14113] Invalid auth token [19114] Connecting to blynk-cloud.com:80 [19251] Invalid auth token [24252] Connecting to blynk-cloud.com:80 [24390] Invalid auth token [29391] Connecting to blynk-cloud.com:80 [29717] Invalid auth token [34718] Connecting to blynk-cloud.com:80 [35149] Invalid auth token [40150] Connecting to blynk-cloud.com:80 [40287] Invalid auth token [45288] Connecting to blynk-cloud.com:80 [45424] Invalid auth token
so now you get connection result of 3, sounds like your router
[45288] Connecting to blynk-cloud.com:80 [45424] Invalid auth token
It is connected to the Internet but is offline with Blynk
it appears that wifi manager doesn't save parameters like it does the ssid and password. i think you must implement your own custom saving code, so that after a reboot the token still exists.
pretty much yes, WM has no native FS dependancy
With Nodemcu works 100% even after reboot With ESP-01you need to setup again (network selection, password and ...) after reboot
Is the hardware problem a software problem