|
|
|
@ -12,6 +12,10 @@
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "config_user.h"
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_PING_HOST_TEST
|
|
|
|
|
#include <ESP8266Ping.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef DISABLE_WIFIMANAGER
|
|
|
|
|
#include <WiFiManager.h> // WiFiManager from bib manager
|
|
|
|
|
#endif
|
|
|
|
@ -266,6 +270,8 @@ float readSensors(uint8_t s) {
|
|
|
|
|
|
|
|
|
|
void wifiConnectionCheck() {
|
|
|
|
|
|
|
|
|
|
bool success = false;
|
|
|
|
|
|
|
|
|
|
if ((wifi_check_interval_counter + WIFI_CHECK_INTERVAL_MS) > millis()) {
|
|
|
|
|
// if check interval is not exceeded abort check
|
|
|
|
|
return;
|
|
|
|
@ -273,11 +279,23 @@ void wifiConnectionCheck() {
|
|
|
|
|
|
|
|
|
|
wifi_check_interval_counter = millis();
|
|
|
|
|
|
|
|
|
|
if (WiFi.status() == WL_CONNECTED) {
|
|
|
|
|
/*if (WiFi.status() == WL_CONNECTED) {
|
|
|
|
|
// if we are connected
|
|
|
|
|
return;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_PING_HOST_TEST
|
|
|
|
|
debug("Ping 192.168.0.85");
|
|
|
|
|
success = Ping.ping(PING_HOST_IP, 3);
|
|
|
|
|
|
|
|
|
|
if (success)
|
|
|
|
|
{
|
|
|
|
|
debug("Ping success");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif // ENABLE_PING_HOST_TEST
|
|
|
|
|
|
|
|
|
|
debug("Connection problem, resetting ESP");
|
|
|
|
|
#ifdef ENABLE_WATCHDOG
|
|
|
|
|
// loop endless, watchdog will reset the device
|
|
|
|
|
while (1 == 1) {}
|
|
|
|
|