changes
This commit is contained in:
@ -4,17 +4,18 @@ from Cheetah.Template import Template
|
||||
|
||||
|
||||
|
||||
|
||||
configItems = [
|
||||
{"label":"_", "key":"magic", "type":"I"},
|
||||
{"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32},
|
||||
{"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64},
|
||||
{"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":64},
|
||||
{"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32},
|
||||
{"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32},
|
||||
{"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32},
|
||||
{"label":"MQTT Topic", "key":"mqttTopic", "type":"C", "length":64},
|
||||
{"label":"MQTT Port", "key":"mqttPort", "type":"I"},
|
||||
{"label":"Measure Period", "key":"measurePeriod", "type":"I"}
|
||||
{"label":"_", "key":"magic", "type":"I", "default": ""},
|
||||
{"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32, "default":"EG-WLAN"},
|
||||
{"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64, "default":"shae3sheuthai2oluNgiqueiyahyumeiphughi8jequeil6taethooyeik1joh5"},
|
||||
{"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":64, "default":"broker.hottis.de"},
|
||||
{"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32, "default":"esp1"},
|
||||
{"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32, "default":"geheim123"},
|
||||
{"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"espClient1"},
|
||||
{"label":"MQTT Topic", "key":"mqttTopic", "type":"C", "length":64, "default":"IoT/espThermometer2/espTherm1/measurement"},
|
||||
{"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":8883},
|
||||
{"label":"Measure Period", "key":"measurePeriod", "type":"I", "default":300}
|
||||
]
|
||||
|
||||
|
||||
|
@ -12,8 +12,10 @@ tConfigBlock configBlock;
|
||||
const uint32_t MAGIC = 0xC0DE0001;
|
||||
extern ESP8266WebServer webServer;
|
||||
|
||||
|
||||
void configServeIndex() {
|
||||
webServer.send(200, "text/html", ""
|
||||
webServer.send(200, "text/html",
|
||||
""
|
||||
"<!doctype html"
|
||||
"<html lang=\"en\">"
|
||||
" <head>"
|
||||
@ -29,7 +31,8 @@ void configServeIndex() {
|
||||
" <td>"
|
||||
" <label for\"$configItem.key\">$configItem.label</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"$configItem.key\" id=\"$configItem.key\"/>"
|
||||
" <input type=\"text\" name=\"$configItem.key\" id=\"$configItem.key\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
#end if
|
||||
@ -43,7 +46,9 @@ void configServeIndex() {
|
||||
" </form>"
|
||||
" </body>"
|
||||
"</html>"
|
||||
"");
|
||||
);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
Serial.println("indexHtml request served");
|
||||
#endif
|
||||
@ -62,4 +67,17 @@ void configServeGetConfiguration() {
|
||||
|
||||
webServer.send(200, "text/html", "configuration saved");
|
||||
}
|
||||
|
||||
|
||||
void showConfiguration() {
|
||||
Serial.println("Configuration is");
|
||||
|
||||
#for $configItem in $configItems
|
||||
#if $configItem.label != "_"
|
||||
Serial.print("$configItem.key = ");
|
||||
Serial.println(configBlock.$configItem.key);
|
||||
|
||||
#end if
|
||||
#end for
|
||||
|
||||
Serial.println("---");
|
||||
}
|
@ -13,3 +13,4 @@ extern tConfigBlock configBlock;
|
||||
|
||||
void configServeIndex();
|
||||
void configServeGetConfiguration();
|
||||
void showConfiguration();
|
Reference in New Issue
Block a user