This commit is contained in:
2018-04-22 22:18:13 +02:00
commit 91c2841ef5
21 changed files with 2500 additions and 0 deletions

56
configurationMode.cpp Normal file
View File

@ -0,0 +1,56 @@
/*
* configurationMode.cpp
*
* Created on: Aug 20, 2017
* Author: wn
*/
#include "defines.h"
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <PubSubClient.h>
#include <EEPROM.h>
#include "configurationMode.h"
#include "configuration.h"
ESP8266WebServer webServer(80);
void configServeNotFound() {
webServer.send(404, "text/plain", "page not found");
#ifdef DEBUG
Serial.println("page not found served");
#endif
}
void setupConfigurationNetwork() {
WiFi.mode(WIFI_AP);
WiFi.softAP(CONFIG_SSID);
#ifdef DEBUG
Serial.println("AP started");
#endif
}
void setupConfigurationServer() {
webServer.on("/", configServeIndex);
webServer.on("/config", configServeGetConfiguration);
webServer.onNotFound(configServeNotFound);
webServer.begin();
#ifdef DEBUG
Serial.println("Webserver started");
#endif
}
void loopConfiguration() {
webServer.handleClient();
}