This commit is contained in:
Wolfgang Hottgenroth 2017-08-20 23:29:14 +02:00
parent 5281b6d075
commit b92451eb98
8 changed files with 104 additions and 50 deletions

View File

@ -86,6 +86,8 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope"/> <storageModule moduleId="refreshScope"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets/>
</storageModule>
</cproject> </cproject>

View File

@ -187,10 +187,10 @@ environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.DTS
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.DTS/value=3600 environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.DTS/value=3600
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.LOCAL/delimiter=\: environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.LOCAL/delimiter=\:
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.LOCAL/operation=replace environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.LOCAL/operation=replace
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.LOCAL/value=1503267971 environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.LOCAL/value=1503268994
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.UTC/delimiter=\: environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.UTC/delimiter=\:
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.UTC/operation=replace environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.UTC/operation=replace
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.UTC/value=1503260771 environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.UTC/value=1503261794
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.ZONE/delimiter=\: environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.ZONE/delimiter=\:
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.ZONE/operation=replace environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.ZONE/operation=replace
environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.ZONE/value=3600 environment/project/io.sloeber.core.toolChain.release.936970421/A.EXTRA.TIME.ZONE/value=3600
@ -472,7 +472,7 @@ environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.COM_PORT/
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.COM_PORT/value=/dev/ttyUSB0 environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.COM_PORT/value=/dev/ttyUSB0
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.ECLIPSE_LOCATION/delimiter=\: environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.ECLIPSE_LOCATION/delimiter=\:
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.ECLIPSE_LOCATION/operation=replace environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.ECLIPSE_LOCATION/operation=replace
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.ECLIPSE_LOCATION/value=${eclipse_home}///////////////////////////////////////////////////////////////////////////////////////// environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.ECLIPSE_LOCATION/value=${eclipse_home}/////////////////////////////////////////////////////////////////////////////////////////////
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/delimiter=\: environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/delimiter=\:
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/operation=replace environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/operation=replace
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/value= environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/value=

View File

@ -4,17 +4,18 @@ from Cheetah.Template import Template
configItems = [ configItems = [
{"label":"_", "key":"magic", "type":"I"}, {"label":"_", "key":"magic", "type":"I", "default": ""},
{"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32}, {"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32, "default":"EG-WLAN"},
{"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64}, {"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64, "default":"shae3sheuthai2oluNgiqueiyahyumeiphughi8jequeil6taethooyeik1joh5"},
{"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":64}, {"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":64, "default":"broker.hottis.de"},
{"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32}, {"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32, "default":"esp1"},
{"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32}, {"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32, "default":"geheim123"},
{"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32}, {"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"espClient1"},
{"label":"MQTT Topic", "key":"mqttTopic", "type":"C", "length":64}, {"label":"MQTT Topic", "key":"mqttTopic", "type":"C", "length":64, "default":"IoT/espThermometer2/espTherm1/measurement"},
{"label":"MQTT Port", "key":"mqttPort", "type":"I"}, {"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":8883},
{"label":"Measure Period", "key":"measurePeriod", "type":"I"} {"label":"Measure Period", "key":"measurePeriod", "type":"I", "default":300}
] ]

View File

@ -12,8 +12,10 @@ tConfigBlock configBlock;
const uint32_t MAGIC = 0xC0DE0001; const uint32_t MAGIC = 0xC0DE0001;
extern ESP8266WebServer webServer; extern ESP8266WebServer webServer;
void configServeIndex() { void configServeIndex() {
webServer.send(200, "text/html", "" webServer.send(200, "text/html",
""
"<!doctype html" "<!doctype html"
"<html lang=\"en\">" "<html lang=\"en\">"
" <head>" " <head>"
@ -29,7 +31,8 @@ void configServeIndex() {
" <td>" " <td>"
" <label for\"$configItem.key\">$configItem.label</label>" " <label for\"$configItem.key\">$configItem.label</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"$configItem.key\" id=\"$configItem.key\"/>" " <input type=\"text\" name=\"$configItem.key\" id=\"$configItem.key\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
#end if #end if
@ -43,7 +46,9 @@ void configServeIndex() {
" </form>" " </form>"
" </body>" " </body>"
"</html>" "</html>"
""); );
#ifdef DEBUG #ifdef DEBUG
Serial.println("indexHtml request served"); Serial.println("indexHtml request served");
#endif #endif
@ -63,3 +68,16 @@ void configServeGetConfiguration() {
webServer.send(200, "text/html", "configuration saved"); 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("---");
}

View File

@ -13,3 +13,4 @@ extern tConfigBlock configBlock;
void configServeIndex(); void configServeIndex();
void configServeGetConfiguration(); void configServeGetConfiguration();
void showConfiguration();

View File

@ -11,31 +11,13 @@
#include "productionMode.h" #include "productionMode.h"
#include "configurationMode.h" #include "configurationMode.h"
ADC_MODE(ADC_VCC); ADC_MODE(ADC_VCC);
//const char* ssid = "EG-WLAN";
//const char* password = "shae3sheuthai2oluNgiqueiyahyumeiphughi8jequeil6taethooyeik1joh5";
//const char* ssid = "OG-WLAN";
//const char* password = "ruc8Chimush2jaetaipeug7shuagh2eruimiemu9Sheik4ur8ooZ5eengeem9ea";
//const char* ssid = "iPhone";
//const char* password = "wollud123456";
//const char* ssid = "WLan-KI-Pro";
//const char* password = "sVAPHCmo";
//const char* mqttServer = "broker.hottis.de";
//const uint16 mqttPort = 8883;
//const char* mqttUsername = "esp2";
//const char* mqttPassword = "test1234";
//const char* clientId = "espTherm2";
//const char* topic = "IoT/espThermometer2/espTherm2/measurement";
//const char* mqttServer = "172.16.2.15";
//const char* mqttServer = "10.11.184.91";
//const uint16_t sleepTime = 300;
@ -73,6 +55,9 @@ void setup() {
} else { } else {
#ifdef DEBUG #ifdef DEBUG
Serial.println("Production mode"); Serial.println("Production mode");
Serial.println();
Serial.println();
showConfiguration();
#endif #endif
setupProduction(); setupProduction();

View File

@ -10,8 +10,10 @@ tConfigBlock configBlock;
const uint32_t MAGIC = 0xC0DE0001; const uint32_t MAGIC = 0xC0DE0001;
extern ESP8266WebServer webServer; extern ESP8266WebServer webServer;
void configServeIndex() { void configServeIndex() {
webServer.send(200, "text/html", "" webServer.send(200, "text/html",
""
"<!doctype html" "<!doctype html"
"<html lang=\"en\">" "<html lang=\"en\">"
" <head>" " <head>"
@ -25,63 +27,72 @@ void configServeIndex() {
" <td>" " <td>"
" <label for\"wifiSsid\">Wifi SSID</label>" " <label for\"wifiSsid\">Wifi SSID</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"wifiSsid\" id=\"wifiSsid\"/>" " <input type=\"text\" name=\"wifiSsid\" id=\"wifiSsid\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"wifiKey\">Wifi Key</label>" " <label for\"wifiKey\">Wifi Key</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"wifiKey\" id=\"wifiKey\"/>" " <input type=\"text\" name=\"wifiKey\" id=\"wifiKey\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"mqttBroker\">MQTT Broker</label>" " <label for\"mqttBroker\">MQTT Broker</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"mqttBroker\" id=\"mqttBroker\"/>" " <input type=\"text\" name=\"mqttBroker\" id=\"mqttBroker\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"mqttUser\">MQTT Username</label>" " <label for\"mqttUser\">MQTT Username</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"mqttUser\" id=\"mqttUser\"/>" " <input type=\"text\" name=\"mqttUser\" id=\"mqttUser\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"mqttPass\">MQTT Password</label>" " <label for\"mqttPass\">MQTT Password</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"mqttPass\" id=\"mqttPass\"/>" " <input type=\"text\" name=\"mqttPass\" id=\"mqttPass\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"mqttClientId\">MQTT ClientId</label>" " <label for\"mqttClientId\">MQTT ClientId</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"mqttClientId\" id=\"mqttClientId\"/>" " <input type=\"text\" name=\"mqttClientId\" id=\"mqttClientId\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"mqttTopic\">MQTT Topic</label>" " <label for\"mqttTopic\">MQTT Topic</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"mqttTopic\" id=\"mqttTopic\"/>" " <input type=\"text\" name=\"mqttTopic\" id=\"mqttTopic\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"mqttPort\">MQTT Port</label>" " <label for\"mqttPort\">MQTT Port</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"mqttPort\" id=\"mqttPort\"/>" " <input type=\"text\" name=\"mqttPort\" id=\"mqttPort\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
" <td>" " <td>"
" <label for\"measurePeriod\">Measure Period</label>" " <label for\"measurePeriod\">Measure Period</label>"
" </td><td>" " </td><td>"
" <input type=\"text\" name=\"measurePeriod\" id=\"measurePeriod\"/>" " <input type=\"text\" name=\"measurePeriod\" id=\"measurePeriod\""
" />"
" </td>" " </td>"
" </tr>" " </tr>"
" <tr>" " <tr>"
@ -93,7 +104,9 @@ void configServeIndex() {
" </form>" " </form>"
" </body>" " </body>"
"</html>" "</html>"
""); );
#ifdef DEBUG #ifdef DEBUG
Serial.println("indexHtml request served"); Serial.println("indexHtml request served");
#endif #endif
@ -133,3 +146,36 @@ void configServeGetConfiguration() {
webServer.send(200, "text/html", "configuration saved"); webServer.send(200, "text/html", "configuration saved");
} }
void showConfiguration() {
Serial.println("Configuration is");
Serial.print("wifiSsid = ");
Serial.println(configBlock.wifiSsid);
Serial.print("wifiKey = ");
Serial.println(configBlock.wifiKey);
Serial.print("mqttBroker = ");
Serial.println(configBlock.mqttBroker);
Serial.print("mqttUser = ");
Serial.println(configBlock.mqttUser);
Serial.print("mqttPass = ");
Serial.println(configBlock.mqttPass);
Serial.print("mqttClientId = ");
Serial.println(configBlock.mqttClientId);
Serial.print("mqttTopic = ");
Serial.println(configBlock.mqttTopic);
Serial.print("mqttPort = ");
Serial.println(configBlock.mqttPort);
Serial.print("measurePeriod = ");
Serial.println(configBlock.measurePeriod);
Serial.println("---");
}

View File

@ -16,3 +16,4 @@ extern tConfigBlock configBlock;
void configServeIndex(); void configServeIndex();
void configServeGetConfiguration(); void configServeGetConfiguration();
void showConfiguration();