This commit is contained in:
Wolfgang Hottgenroth 2019-11-25 21:06:19 +01:00
parent 859dcf5f24
commit 5a9ff398a4
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
2 changed files with 12 additions and 8 deletions

View File

@ -8,8 +8,8 @@
#ifndef DEFINES_H_
#define DEFINES_H_
#define DEBUG
//#define SLEEP
// #define DEBUG
#define SLEEP
#define EEPROM_ADDR 0

View File

@ -75,15 +75,20 @@ void read_thermometer() {
}
void loopApplication() {
static uint32_t lastMillis = 0;
mqttLoop();
#ifndef SLEEP
static uint32_t lastMillis = 0;
uint32_t currentMillis = millis();
if (currentMillis - lastMillis > 1000) {
if (currentMillis - lastMillis > (configBlock.measurePeriod * 1000)) {
lastMillis = currentMillis;
#endif
read_thermometer();
#ifndef SLEEP
}
#endif
#ifdef SLEEP
@ -93,7 +98,6 @@ void loopApplication() {
mqttClient.disconnect();
ESP.deepSleep(configBlock.measurePeriod * 1000000);
#endif
}
}