first working version
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
tConfigBlock configBlock;
|
||||
const uint32_t MAGIC = 3235774467;
|
||||
const uint32_t MAGIC = 3235774468;
|
||||
const char* CONFIG_SSID = "espconfig";
|
||||
extern ESP8266WebServer webServer;
|
||||
|
||||
@ -39,7 +39,8 @@ void configServeIndex() {
|
||||
strcpy(configBlock.mqttTopic, "IoT/RainSensor1/Value");
|
||||
strcpy(configBlock.mqttDebugTopic, "IoT/RainSensor1/Debug");
|
||||
configBlock.debugMode = 0;
|
||||
configBlock.period = 500;
|
||||
configBlock.period = 5;
|
||||
configBlock.debounce = 300;
|
||||
}
|
||||
|
||||
if (! checkAuthentication()) {
|
||||
@ -244,7 +245,7 @@ void configServeIndex() {
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"period\">Period</label>"
|
||||
" <label for\"period\">Period (s)</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"period\" id=\"period\" ";
|
||||
|
||||
@ -252,6 +253,20 @@ void configServeIndex() {
|
||||
buffer += configBlock.period;
|
||||
buffer += "\"";
|
||||
|
||||
buffer +=
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"debounce\">Debounce (us)</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"debounce\" id=\"debounce\" ";
|
||||
|
||||
buffer += " value=\"";
|
||||
buffer += configBlock.debounce;
|
||||
buffer += "\"";
|
||||
|
||||
buffer +=
|
||||
" />"
|
||||
" </td>"
|
||||
@ -307,6 +322,8 @@ void configServeGetConfiguration() {
|
||||
configBlock.debugMode = atoi(arg.c_str());
|
||||
arg = webServer.arg("period");
|
||||
configBlock.period = atoi(arg.c_str());
|
||||
arg = webServer.arg("debounce");
|
||||
configBlock.debounce = atoi(arg.c_str());
|
||||
|
||||
configBlock.magic = MAGIC;
|
||||
|
||||
@ -383,6 +400,10 @@ void showConfiguration() {
|
||||
Serial.print(configBlock.period);
|
||||
Serial.println(">");
|
||||
|
||||
Serial.print("debounce = <");
|
||||
Serial.print(configBlock.debounce);
|
||||
Serial.println(">");
|
||||
|
||||
|
||||
Serial.println("---");
|
||||
}
|
Reference in New Issue
Block a user