This commit is contained in:
2018-04-27 23:37:40 +02:00
parent 6c78b83de2
commit 2e0f810c0c
8 changed files with 72 additions and 6 deletions

View File

@ -20,7 +20,9 @@ configItems = [
{"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RainSensor1/Debug"},
{"label":"DebugMode", "key":"debugMode", "type":"I", "default":0},
{"label":"Period (s)", "key":"period", "type":"I", "default":5},
{"label":"Debounce (us)", "key":"debounce", "type":"I", "default":300}
{"label":"Debounce (us)", "key":"debounce", "type":"I", "default":300},
{"label":"ml per tock", "key":"spoonfill", "type":"F", "default":3.5},
{"label":"Measure Area", "key":"measureArea", "type":"F", "default":68.75}
]

View File

@ -35,6 +35,8 @@ void configServeIndex() {
strcpy(configBlock.$configItem.key, "$configItem.default");
#else if $configItem.type == "I"
configBlock.$configItem.key = $configItem.default;
#else if $configItem.type == "F"
configBlock.$configItem.key = $configItem.default;
#end if
#end if
#end for
@ -79,6 +81,10 @@ void configServeIndex() {
buffer += " value=\"";
buffer += configBlock.$configItem.key;
buffer += "\"";
#else if $configItem.type == "F"
buffer += " value=\"";
buffer += configBlock.$configItem.key;
buffer += "\"";
#end if
buffer +=
@ -119,6 +125,8 @@ void configServeGetConfiguration() {
strcpy(configBlock.$configItem.key, arg.c_str());
#else if $configItem.type == "I"
configBlock.$configItem.key = atoi(arg.c_str());
#else if $configItem.type == "F"
configBlock.$configItem.key = atof(arg.c_str());
#end if
#end if
#end for

View File

@ -4,6 +4,8 @@ typedef struct {
char ${configItem.key}[$configItem.length];
#else if $configItem.type == 'I'
uint32_t $configItem.key;
#else if $configItem.type == 'F'
float $configItem.key;
#end if
#end for
} tConfigBlock;