[CODE] print sleep durations as well

This commit is contained in:
Jannik Beyerstedt 2018-08-08 00:23:41 +02:00
parent 68d0235c8a
commit efd7af4b27

View file

@ -1,5 +1,6 @@
/*
* ESP32 Environmental Sensor Node with SI7021s (Temp + Hum)
* ESP32 Environmental Sensor Node with SI7021 (Temp + Hum)
* (to be build with custom compiled ESP-IDF)
*
* copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de | code@jannikbeyerstedt.de
* license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
@ -8,8 +9,8 @@
#include "Arduino.h"
#include "si7021.hpp"
#include <WiFi.h>
#include <driver/adc.h>
#include <WiFi.h>
#define BOARD_HUZZAH 1 /* Adafruit Feather HUZZAH */
#define BOARD_LOLIN 2 /* LoLin NodeMCU */
@ -17,9 +18,9 @@
#define BOARD_ESP32 4 /* standalone ESP32 */
/* DEBUG SETTINGS */
#define TEST /* use test config and database */
#define PRINT_INFO /* enable Serial output */
#define PRINT_DEBUG /* enable additional debug output */
#define TEST /* use test config and database */
#define PRINT_INFO /* enable Serial output */
// #define PRINT_DEBUG /* enable additional debug output */
/* CONFIGURATION OPTIONS */
#ifndef NODENAME
@ -27,15 +28,15 @@
#endif
#ifndef BOARD
#define BOARD 4 /* IMPORTANT: select one of the BOARD_* types */
#define BOARD 0 /* IMPORTANT: select one of the BOARD_* types */
#endif
#define DB_HOSTNAME "ursaminor.fra80"
#define DB_PASSWD "c2Vuc29yczpTZW5zb3JzLXcuaW5mbHV4QGhvbWU" // BasicAuth String
#if BOARD == BOARD_ESP32
#define BATT_FULL 3600 // 3.6V VCC (4.3V Battery) TODO: get actual value
#define BATT_CUTOFF 2300 // 2.3V VCC (3.0V Battery) TODO: get actual value
#define BATT_FULL 3600 // 3.6V VCC (4.3V Battery) TODO: get actual value
#define BATT_CUTOFF 200 // 2.3V VCC (3.0V Battery) TODO: get actual value
#else
#error "unsupported board chosen"
#endif
@ -266,7 +267,7 @@ extern "C" void app_main() {
WiFi.disconnect(true);
// continue with deep sleep at end of main function
} else { // ELSE: !wifiConnect
} else { // ELSE: !wlanConnect
/* WIFI CONNECT FAILED, WAIT MAX 5 MINUTES IN DEEP SLEEP */
wlanConnectFailCnt++;
@ -279,12 +280,13 @@ extern "C" void app_main() {
} else {
doDeepSleep(sampleInterval_sec);
}
} // ENDIF: wifiConnect
} // ENDIF: wlanConnect
} else { // ELSE: sampleCnt < sampleAvgNum
#ifdef PRINT_INFO
Serial.printf("[INFO ] %d of %d samples collected -> sleep\n", sampleCnt, sampleAvgNum);
Serial.printf("[INFO ] %d of %d samples collected -> sleep %4d s\n", sampleCnt, sampleAvgNum,
sampleInterval_sec);
// continue with deep sleep at end of main function
#endif