so far so good
This commit is contained in:
55
configurationMode.cpp
Normal file
55
configurationMode.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
s/*
|
||||
* configurationMode.cpp
|
||||
*
|
||||
* Created on: Aug 20, 2017
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WebServer.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();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user