fix uptime calculation

This commit is contained in:
Wolfgang Hottgenroth 2018-04-27 10:49:00 +02:00
parent cc511464a0
commit 6c78b83de2
Signed by: wn
GPG Key ID: B586EAFCDF2F65F4
3 changed files with 7 additions and 7 deletions

View File

@ -29,7 +29,6 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/pubsubclient}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/libraries/OneWire-master}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/ds18b20}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/onewire}&quot;"/>
</option>
<inputType id="io.sloeber.compiler.cpp.sketch.input.587259888" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/>
</tool>
@ -45,7 +44,6 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/pubsubclient}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/libraries/OneWire-master}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/ds18b20}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RainSensor/onewire}&quot;"/>
</option>
<inputType id="io.sloeber.compiler.c.sketch.input.931476786" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/>
</tool>

View File

@ -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=1524742685
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.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=1524735485
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.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
@ -466,10 +466,10 @@ environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.BOARD_NA
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.BOARD_NAME/value=NodeMCU 1.0 (ESP-12E Module)
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.COM_PORT/delimiter=\:
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.COM_PORT/operation=replace
environment/project/io.sloeber.core.toolChain.release.1856809793/JANTJE.COM_PORT/value=/dev/ttyUSB5
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=

View File

@ -159,6 +159,7 @@ void loopProduction() {
static uint32_t lastUptimeMillis = 0;
if (currentMillis > (lastUptimeMillis + 1000)) {
lastUptimeMillis = currentMillis;
uptime++;
}
@ -174,6 +175,7 @@ void loopProduction() {
interrupts();
#ifdef DEBUG
Serial.print(rainCnt);
Serial.println();
#endif
// battery voltage
@ -200,7 +202,7 @@ void loopProduction() {
// MQTT publishing
#define BUF_SIZE 128
#define BUF_SIZE 256
char buf[BUF_SIZE];
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);