From 36b0c72f9b9a34b4c7b6c5dcac13ade3c9e8d5d7 Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Thu, 9 Feb 2023 17:24:05 +0100 Subject: [PATCH] ESP8266 pin feature added --- firmware/firmware.ino | 22 ++++++++++++++++++++-- firmware/libraries/ESP8266Ping | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) create mode 160000 firmware/libraries/ESP8266Ping diff --git a/firmware/firmware.ino b/firmware/firmware.ino index f73d166..e5d39b1 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -12,6 +12,10 @@ #include "config.h" #include "config_user.h" +#ifdef ENABLE_PING_HOST_TEST +#include +#endif + #ifndef DISABLE_WIFIMANAGER #include // 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) {} diff --git a/firmware/libraries/ESP8266Ping b/firmware/libraries/ESP8266Ping new file mode 160000 index 0000000..934e701 --- /dev/null +++ b/firmware/libraries/ESP8266Ping @@ -0,0 +1 @@ +Subproject commit 934e701dcee743fe1ec564d0c2d64bd99e8d7bf3