Compare commits

..

No commits in common. "1f347582b0f3a19347c38d6e134d95eac41c3dc1" and "9a920aeb885d15b26dcd6d6bc56caa35d6e3939e" have entirely different histories.

2 changed files with 25 additions and 54 deletions

View file

@ -12,7 +12,7 @@
#define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover
#define RESET_ESP_TIME_INTERVAL_MS (60*60*12*1000) // reset every 12 hours
#define WIND_SENSOR_MEAS_TIME_S 15
#define WATCHDOG_TIMEOUT_MS WDTO_8S // Look at Esp.h for further possible time declarations
#define WATCHDOG_TIMEOUT_MS 30000
#define WIFI_CHECK_INTERVAL_MS 120000
#define INFLUXDB_TIMEOUT_MS 1000

View file

@ -1,9 +1,6 @@
// Standard ESP8266 libs from project folder
#include <ESP8266mDNS.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiType.h>
#include <esp.h>
#include <WiFiClient.h> // WiFiClient
@ -80,10 +77,6 @@ void debug(String x) {
void setup() {
#ifdef ENABLE_WATCHDOG
//wdt_disable();
#endif
#if defined(DEBUG) || defined(SERIAL_FEATURE)
Serial.begin(SERIAL_BAUD_RATE);
#endif
@ -139,11 +132,8 @@ void setup() {
#else // not in battery mode
#ifdef ENABLE_WATCHDOG
wdt_disable();
wdt_reset();
// Enable the internal watchdog
wdt_enable(WATCHDOG_TIMEOUT_MS);
debug("Watchdog enabled");
ESP.wdtEnable(WATCHDOG_TIMEOUT_MS);
#endif
#endif
}
@ -262,6 +252,7 @@ float readSensors(uint8_t s) {
void wifiConnectionCheck() {
/*
if ((wifi_check_interval_counter + WIFI_CHECK_INTERVAL_MS) > millis()) {
// if check interval is not exceeded abort check
return;
@ -274,32 +265,29 @@ void wifiConnectionCheck() {
return;
}
// TODO Was muss hier getan werden?
}
#ifdef DISABLE_WIFIMANAGER
void wifi_disconnected(WiFiEvent_t event) {
if (wifi_reconnect_cnt >= 5) {
debug("\nReboot, to much reconnects to wifi done before");
ESP.restart();
} else {
wifi_reconnect_cnt++;
debug("no wifi connection, try to reconnect " + String(wifi_reconnect_cnt));
wifi_reconnect_cnt++;
wifiConnect();
WiFi.disconnect();
WiFi.mode(WIFI_OFF);
WiFi.mode(WIFI_STA);
#ifdef WEBUPDATER_FEATURE
setWifiReconnectCnt(wifi_reconnect_cnt);
#endif
}
if (wifi_reconnect_cnt >= 5) {
debug("\nReboot");
ESP.restart();
} else {
wifiConnect();
//initWifiBasedSW();
}
*/
}
#endif
//*************************************************************************//
@ -330,7 +318,7 @@ void wifiConnect() {
#endif
}
#else // DISABLE_WIFIMANAGER is defined
#else // DISABLE_WIFIMANAGER
if (!WiFi.config(local_IP, gateway, subnet)) {
debug("Failed to set IP configuration");
@ -338,9 +326,6 @@ void wifiConnect() {
debug("Successful set IP configuration");
}
// bind the check function to the disconnected wifi event
WiFi.onEvent(wifi_disconnected, WIFI_EVENT_STAMODE_DISCONNECTED);
WiFi.begin(WIFI_SSID, WIFI_PASSWD);
WiFi.setAutoReconnect(true);
@ -372,15 +357,15 @@ void criticalBatCheck() {
void loop() {
#ifdef ENABLE_WATCHDOG
ESP.wdtFeed();
#endif
#ifdef BATTERY_POWERED
delay(50);
return;
#else // not in BATTERY_POWERED mode
#ifdef ENABLE_WATCHDOG
WDT_FEED();
#endif
#else
// call fsm loop function
_fsm_loop();
@ -404,9 +389,6 @@ void _fsm_loop()
update_webserver_cnt = millis();
doWebUpdater();
}
#ifdef ENABLE_WATCHDOG
WDT_FEED();
#endif
#endif
#ifdef HTTP_CALL_SEND_JSON_DATA
@ -419,9 +401,6 @@ void _fsm_loop()
http_call_send_json_data_cnt = millis();
http_call_send_json_data();
}
#ifdef ENABLE_WATCHDOG
WDT_FEED();
#endif
#endif
switch (fsm_state)
@ -625,10 +604,6 @@ void _fsm_loop()
// Send HTTP GET request
int httpResponseCode = http.GET();
#ifdef ENABLE_WATCHDOG
WDT_FEED();
#endif
if (httpResponseCode > 0) {
String response = http.getString();
debug("http response code: " + String(httpResponseCode) + " = " + response);
@ -768,10 +743,6 @@ void http_call_send_json_data()
// Send HTTP GET request
int httpResponseCode = http.GET();
#ifdef ENABLE_WATCHDOG
WDT_FEED();
#endif
if (httpResponseCode > 0) {
String response = http.getString();
debug("http response code: " + String(httpResponseCode) + " = " + response);