Comments (4)
Well that almost worked. I had about 15 hours of operation without a problem. That's a record.
I should note that the symptoms changed a bit. When the Webserver became unresponsive, Ping continued to work . After an hour or so it recovered on its own for no clear reason.
So: I depreciated the PING solution and added in this proposed solution.
me-no-dev/ESPAsyncWebServer#54 (comment)
Presently testing. We will see. It is doing something the Webserver is not very snappy as before.
EDIT ** overnight it became unresponsive again:(
from fsbrowserng.
This is clearly a work-around, but it seems to resolve 'unresponsive' behavior. Then code it not meant to run alone. Merge it into your existing sketch that has 'unresponsive' issues.
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
#include <ESP8266Ping.h>
#define FPM_SLEEP_MAX_TIME 0xFFFFFFF
unsigned long pingTest = 1000UL * 60UL * 30UL; // Test connection every 30 minuites
unsigned long prevMillis = 0; // used for temp timing counter
extern "C" {
#include "user_interface.h" // Required for wifi_station_connect() to work
}
extern "C" {
extern char *netif_list;
uint8_t etharp_request(char *, char *); // required for forceArp to work
}
void forceARP() {
char *netif = netif_list;
while (netif)
{
etharp_request((netif), (netif + 4));
netif = *((char **) netif);
}
}
void setup() {
wifi_set_sleep_type(NONE_SLEEP_T); // May help stability
// add your code to connect to the internet and so forth
}
void loop() {
// ----------------------Connectivity testing within Loop() -----------
HTTPClient http_1; // used in ping test
unsigned long currentMillis = millis(); // timer for data
unsigned long pingMillis = millis(); // timer for data
if ((pingMillis - prevMillis) > pingTest) {
prevMillis = pingMillis;
WiFiOff();
Serial.print("WiFi - OFF ");
delay (20);
WiFiOn();
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi - ON");
if (Ping.ping(WiFi.gatewayIP())) {
Serial.print("ping gateway Success!! Ping Time (mS) = "); Serial.println(Ping.averageTime());
forceARP();
} else {
Serial.println("Failed ping to gateway!");
ESP.restart();
}
if (Ping.ping(WiFi.localIP()), 1) {
Serial.print("ping localIP Success!! Ping Time (mS) = "); Serial.println(Ping.averageTime());
forceARP();
} else {
Serial.println("ping Error :(");
ESP.restart();
}
http_1.begin("http://api.wunderground.com"); // or some other web site you like
int httpCode = http_1.GET();
if (httpCode > 0) {
Serial.println ("connection test okay!");
}
else {
Serial.print("connection test failed! code: ");
Serial.println(httpCode);
ESP.restart();
}
http_1.end();
}
// -------------------- end testing ---------------------------
// rest of your loop goes here
}
//----------------------------------- WiFi On OFF ----------------------------------
void WiFiOn() {
wifi_fpm_do_wakeup();
wifi_fpm_close();
//Serial.println("Reconnecting");
wifi_set_opmode(STATION_MODE);
wifi_station_connect();
}
void WiFiOff() {
//Serial.println("diconnecting client and wifi");
//client.disconnect();
wifi_station_disconnect();
wifi_set_opmode(NULL_MODE);
wifi_set_sleep_type(MODEM_SLEEP_T);
wifi_fpm_open();
wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);
}
from fsbrowserng.
Sorry short in time at the moment
May be able to support you in this over the holidays
My temp sensor based on this seems to reboot every few days
And stops responding to are requests
But web server still works. May be related
from fsbrowserng.
Thanks. Possibly related. Also try, accessing the. server from an iPhone using Safari. After a couple of refreshes it begins to ignore the Safari browser. Here'a a link to my sketch. It plots actual temperature vs Wunderground forecast..
from fsbrowserng.
Related Issues (20)
- Not connecting to WIFI correctly HOT 1
- Can't get STA to work with "StartHere" example HOT 14
- Why ESPHTTPServer.begin is blocking till wifi connected? HOT 5
- Can't enter AP mode HOT 6
- Force Download from ESP8266
- NTP doesn't work? HOT 3
- SSL support
- Has FSBrowserNG been tested with the new ver 2.4.1 board manager? HOT 10
- IP address is 0.0.0.0 on serial output on Starthere HOT 2
- callback_example upload is fine but it gets a reset after GotIp address HOT 11
- AP fallback if SSID timeout? HOT 2
- Still no connection on first start and show IP 0.0.0.0 on Serial port
- Crashes on saving config new
- Been trying to put this on a ESP32
- Arduino Json V6 library issue 'DynamicJsonBuffer' was not declared in this scope HOT 3
- starthere.ino compiled and uploaded along with the SPIFFS data but not AP is started HOT 1
- change the way to enter AP mode
- Switch to AP Mode without Reset HOT 1
- Unable to edit index.html HOT 2
- List of available networks showing empty if some SSID has an unprintable character
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsbrowserng.