ignore, totalizer, debug
This commit is contained in:
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/Release/
|
||||
libraries/includes/configuration.cpp
|
||||
libraries/includes/configuration.h
|
||||
sketch.esp8266.esp8266.nodemcu.bin
|
||||
sketch.esp8266.esp8266.nodemcu.elf
|
||||
sketch/sketch.esp8266.esp8266.nodemcu.bin
|
||||
sketch/sketch.esp8266.esp8266.nodemcu.elf
|
@ -66,6 +66,7 @@ void loopApplication() {
|
||||
uptime++;
|
||||
}
|
||||
|
||||
static uint32_t totalCnt = 0;
|
||||
static uint32_t lastMillis = 0;
|
||||
if (currentMillis > (lastMillis + (configBlock.valuesPeriod * 1000))) {
|
||||
lastMillis = currentMillis;
|
||||
@ -80,11 +81,12 @@ void loopApplication() {
|
||||
Serial.print(rainCnt);
|
||||
Serial.println();
|
||||
#endif
|
||||
totalCnt += rainCnt;
|
||||
|
||||
// MQTT publishing
|
||||
#define BUF_SIZE 256
|
||||
char buf[BUF_SIZE];
|
||||
snprintf(buf, BUF_SIZE-1, "{\"raincnt\":%ld, \"uptime\":%ld}", rainCnt, uptime);
|
||||
snprintf(buf, BUF_SIZE-1, "{\"raincnt\":%ld, \"totalCnt\":%ld, \"uptime\":%ld}", rainCnt, totalCnt, uptime);
|
||||
mqttClient.publish(configBlock.mqttValuesTopic, buf);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user