changes
This commit is contained in:
parent
6c78b83de2
commit
2e0f810c0c
@ -184,10 +184,10 @@ environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.DT
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.DTS/value=3600
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.LOCAL/delimiter=\:
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.LOCAL/operation=replace
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.LOCAL/value=1524816391
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.LOCAL/value=1524860955
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.UTC/delimiter=\:
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.UTC/operation=replace
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.UTC/value=1524809191
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.UTC/value=1524853755
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.ZONE/delimiter=\:
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.ZONE/operation=replace
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/A.EXTRA.TIME.ZONE/value=3600
|
||||
@ -469,7 +469,7 @@ environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.COM_PORT
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.COM_PORT/value=/dev/ttyUSB4
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.ECLIPSE_LOCATION/delimiter=\:
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.ECLIPSE_LOCATION/operation=replace
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.ECLIPSE_LOCATION/value=${eclipse_home}/////////////////////////////////////////////////
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.ECLIPSE_LOCATION/value=${eclipse_home}//////////////////////////////////////////////////////////////////////////
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.EXTRA.ALL/delimiter=\:
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.EXTRA.ALL/operation=replace
|
||||
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.EXTRA.ALL/value=
|
||||
|
@ -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}
|
||||
]
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -41,6 +41,8 @@ void configServeIndex() {
|
||||
configBlock.debugMode = 0;
|
||||
configBlock.period = 5;
|
||||
configBlock.debounce = 300;
|
||||
configBlock.spoonfill = 3.5;
|
||||
configBlock.measureArea = 68.75;
|
||||
}
|
||||
|
||||
if (! checkAuthentication()) {
|
||||
@ -267,6 +269,34 @@ void configServeIndex() {
|
||||
buffer += configBlock.debounce;
|
||||
buffer += "\"";
|
||||
|
||||
buffer +=
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"spoonfill\">ml per tock</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"spoonfill\" id=\"spoonfill\" ";
|
||||
|
||||
buffer += " value=\"";
|
||||
buffer += configBlock.spoonfill;
|
||||
buffer += "\"";
|
||||
|
||||
buffer +=
|
||||
" />"
|
||||
" </td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td>"
|
||||
" <label for\"measureArea\">Measure Area</label>"
|
||||
" </td><td>"
|
||||
" <input type=\"text\" name=\"measureArea\" id=\"measureArea\" ";
|
||||
|
||||
buffer += " value=\"";
|
||||
buffer += configBlock.measureArea;
|
||||
buffer += "\"";
|
||||
|
||||
buffer +=
|
||||
" />"
|
||||
" </td>"
|
||||
@ -324,6 +354,10 @@ void configServeGetConfiguration() {
|
||||
configBlock.period = atoi(arg.c_str());
|
||||
arg = webServer.arg("debounce");
|
||||
configBlock.debounce = atoi(arg.c_str());
|
||||
arg = webServer.arg("spoonfill");
|
||||
configBlock.spoonfill = atof(arg.c_str());
|
||||
arg = webServer.arg("measureArea");
|
||||
configBlock.measureArea = atof(arg.c_str());
|
||||
|
||||
configBlock.magic = MAGIC;
|
||||
|
||||
@ -404,6 +438,14 @@ void showConfiguration() {
|
||||
Serial.print(configBlock.debounce);
|
||||
Serial.println(">");
|
||||
|
||||
Serial.print("spoonfill = <");
|
||||
Serial.print(configBlock.spoonfill);
|
||||
Serial.println(">");
|
||||
|
||||
Serial.print("measureArea = <");
|
||||
Serial.print(configBlock.measureArea);
|
||||
Serial.println(">");
|
||||
|
||||
|
||||
Serial.println("---");
|
||||
}
|
@ -14,6 +14,8 @@ typedef struct {
|
||||
uint32_t debugMode;
|
||||
uint32_t period;
|
||||
uint32_t debounce;
|
||||
float spoonfill;
|
||||
float measureArea;
|
||||
} tConfigBlock;
|
||||
|
||||
extern const uint32_t MAGIC;
|
||||
|
@ -14,6 +14,6 @@
|
||||
|
||||
#define CONFIG_SWITCH 0
|
||||
#define HALL_PIN 13
|
||||
#define ONE_WIRE_BUS 0
|
||||
#define ONE_WIRE_BUS 12
|
||||
|
||||
#endif /* DEFINES_H_ */
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include <PubSubClient.h>
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
|
||||
|
||||
volatile uint32_t cnt = 0;
|
||||
uint32_t uptime = 0;
|
||||
|
||||
@ -177,6 +177,15 @@ void loopProduction() {
|
||||
Serial.print(rainCnt);
|
||||
Serial.println();
|
||||
#endif
|
||||
/*
|
||||
float rainVol = rainCnt * configBlock.spoonfill;
|
||||
int16_t r1 = (int)rainVol;
|
||||
int16_t r2 = (int)((rainVol - r1)*100);
|
||||
#ifdef DEBUG
|
||||
Serial.print(rainVol);
|
||||
Serial.println();
|
||||
#endif
|
||||
*/
|
||||
|
||||
// battery voltage
|
||||
float battery = batteryCalc(analogRead(A0));
|
||||
@ -204,6 +213,7 @@ void loopProduction() {
|
||||
// MQTT publishing
|
||||
#define BUF_SIZE 256
|
||||
char buf[BUF_SIZE];
|
||||
/* snprintf(buf, BUF_SIZE-1, "{\"rainvol\":%d.%d, \"battery\":%d.%d, \"uptime\":%ld, \"temperature\":%ld.%ld}", r1, r2, b1, b2, uptime, t1, t2); */
|
||||
snprintf(buf, BUF_SIZE-1, "{\"raincnt\":%ld, \"battery\":%d.%d, \"uptime\":%ld, \"temperature\":%ld.%ld}", rainCnt, b1, b2, uptime, t1, t2);
|
||||
client.publish(configBlock.mqttTopic, buf);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user