feature/InfluxDB-Connection-Update #1

Merged
klaute merged 39 commits from feature/InfluxDB-Connection-Update into master 2022-05-23 17:36:59 +02:00
3 changed files with 27 additions and 10 deletions
Showing only changes of commit f392fce1cc - Show all commits

0
firmware/README.md Normal file → Executable file
View file

14
firmware/firmware.ino Executable file → Normal file
View file

@ -35,11 +35,6 @@ void debug(String x) {
void setup() {
// Erase WiFi Credentials, enable, compile, flash, disable and reflash.
//WiFi.disconnect(true);
//delay(2000);
//ESP.reset();
#if defined(DEBUG) || defined(SERIAL_FEATURE)
Serial.begin(115200);
#endif
@ -69,11 +64,12 @@ void setup() {
wifiManager.setConnectTimeout(WIFI_AUTOCONNECT_TIMEOUT_S); // the time in seconds to wait for the known wifi connection
wifiManager.setTimeout(WIFI_CONFIG_PORTAL_TIMEOUT_S); // the time in seconds to wait for the user to configure the device
if (!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF")) {
debug("WiFi connection failed, going into deep sleep ...");
while (!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF"))
{
debug("WiFi connection failed, try again in 5 seconds...");
// If autoconnect to WLAN failed and no client connected, go to deep sleep
ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
delay(100);
//ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
delay(5000);
}
debug("Connected!");

23
firmware/webUpdater.ino Executable file → Normal file
View file

@ -27,7 +27,8 @@ void setupWebUpdater(String device, String ip)
httpUpdater.setup(&httpServer);
httpServer.on("/", showHTMLMain); // oko specific site
httpServer.on("/", showHTMLMain);
httpServer.on("/resetWifiManager", resetWifiManager);
httpServer.begin();
@ -63,3 +64,23 @@ void showHTMLMain(void) {
httpServer.send(200, "text/html", message);
}
void resetWifiManager()
{
String message = "<html><head><title>OKO Weatherstation - " + String(_webUpdater_dev) + "</title>"
"<meta http-equiv=\"refresh\" content=\"20\">"
"</head><body>"
"Reset WifiManager config.<br>"
"Rebooting...<br>"
"</body></html>";
httpServer.send(200, "text/html", message);
// Erase WiFi Credentials, enable, compile, flash, disable and reflash.
WiFiManager.resetSettings()
delay(5000);
ESP.restart();
}