InfluxDB hostname replaced by IP v4 address. Added a config setup portal timeout.

This commit is contained in:
klaute 2018-07-19 20:13:08 +02:00
parent a8c40a7e23
commit d744fffeb0
2 changed files with 15 additions and 4 deletions

View file

@ -10,10 +10,13 @@
#define SENSOR_PRESSURE 4
#define SENSOR_BAT_VOLTAGE 5
#define WIFI_AUTOCONNECT_TIMEOUT_S 60
#define WIFI_CONFIG_PORTAL_TIMEOUT_S 60
#define UPDATE_SENSOR_INTERVAL_S 10
#define UPDATE_WEBSERVER_INTVERVAL_S 1
#define DELAY_LOOP_MS 50
#define POWERSAVING_SLEEP_S 600
#define BAT_LOW_VOLTAGE 3.4
#define STATUS_LED_PIN BUILTIN_LED
@ -30,7 +33,8 @@
#define BME280_ADDRESS 0x76
const char *INFLUXDB_HOST = "influxdb.okoyono.de";
//const char *INFLUXDB_HOST = "influxdb.okoyono.de";
const char *INFLUXDB_HOST = "37.59.213.225";
const uint16_t INFLUXDB_PORT = 80;
const char *INFLUXDB_DB = "weatherstation";
const char *INFLUXDB_USER = "oko";

View file

@ -64,14 +64,19 @@ void setup() {
// Establish WiFi connection
String wifiName = "oko-weather-" + String(ESP.getChipId());
wifiManager.setMinimumSignalQuality(15);
wifiManager.setConnectTimeout(60);
wifiManager.setConnectTimeout(60); // the time in seconds to wait for the known wifi connection
wifiManager.setTimeout(60); // the time in seconds to wait for the user to configure the device
if (!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF")) {
#ifdef DEBUG
Serial.println("WiFi connection failed, we reboot ...");
#endif
ESP.reset();
delay(1000);
ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
delay(100);
}
#ifdef DEBUG
@ -113,6 +118,7 @@ void setup() {
// the ESP.deepSleep requires microseconds as input, after the sleep the system will run into the setup routine
ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
delay(100);
#endif
@ -128,6 +134,7 @@ void lowBatCheck()
Serial.println("Low battery, going into deep sleep.");
#endif
ESP.deepSleep(4294967295); // battery low, shutting down
delay(100);
}
}