changes
This commit is contained in:
parent
5281b6d075
commit
b92451eb98
@ -86,6 +86,8 @@
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets/>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
|
@ -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.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/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/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/operation=replace
|
||||
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.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/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/operation=replace
|
||||
environment/project/io.sloeber.core.toolChain.release.936970421/JANTJE.EXTRA.C.COMPILE/value=
|
||||
|
@ -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();
|
@ -11,31 +11,13 @@
|
||||
#include "productionMode.h"
|
||||
#include "configurationMode.h"
|
||||
|
||||
|
||||
|
||||
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 {
|
||||
#ifdef DEBUG
|
||||
Serial.println("Production mode");
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
showConfiguration();
|
||||
#endif
|
||||
|
||||
setupProduction();
|
||||
|
@ -10,8 +10,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>"
|
||||
@ -25,63 +27,72 @@ void configServeIndex() {
|
||||
" <td>"
|
||||
" <label for\"wifiSsid\">Wifi SSID</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"wifiSsid\" id=\"wifiSsid\"/>"
|
||||
" <input type=\"text\" name=\"wifiSsid\" id=\"wifiSsid\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"wifiKey\">Wifi Key</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"wifiKey\" id=\"wifiKey\"/>"
|
||||
" <input type=\"text\" name=\"wifiKey\" id=\"wifiKey\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"mqttBroker\">MQTT Broker</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"mqttBroker\" id=\"mqttBroker\"/>"
|
||||
" <input type=\"text\" name=\"mqttBroker\" id=\"mqttBroker\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"mqttUser\">MQTT Username</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"mqttUser\" id=\"mqttUser\"/>"
|
||||
" <input type=\"text\" name=\"mqttUser\" id=\"mqttUser\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"mqttPass\">MQTT Password</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"mqttPass\" id=\"mqttPass\"/>"
|
||||
" <input type=\"text\" name=\"mqttPass\" id=\"mqttPass\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"mqttClientId\">MQTT ClientId</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"mqttClientId\" id=\"mqttClientId\"/>"
|
||||
" <input type=\"text\" name=\"mqttClientId\" id=\"mqttClientId\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"mqttTopic\">MQTT Topic</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"mqttTopic\" id=\"mqttTopic\"/>"
|
||||
" <input type=\"text\" name=\"mqttTopic\" id=\"mqttTopic\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"mqttPort\">MQTT Port</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"mqttPort\" id=\"mqttPort\"/>"
|
||||
" <input type=\"text\" name=\"mqttPort\" id=\"mqttPort\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"measurePeriod\">Measure Period</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"measurePeriod\" id=\"measurePeriod\"/>"
|
||||
" <input type=\"text\" name=\"measurePeriod\" id=\"measurePeriod\""
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
@ -93,7 +104,9 @@ void configServeIndex() {
|
||||
" </form>"
|
||||
" </body>"
|
||||
"</html>"
|
||||
"");
|
||||
);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
Serial.println("indexHtml request served");
|
||||
#endif
|
||||
@ -132,4 +145,37 @@ void configServeGetConfiguration() {
|
||||
|
||||
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("---");
|
||||
}
|
@ -16,3 +16,4 @@ extern tConfigBlock configBlock;
|
||||
|
||||
void configServeIndex();
|
||||
void configServeGetConfiguration();
|
||||
void showConfiguration();
|
Loading…
x
Reference in New Issue
Block a user