Added millis() logging support - could be used to debug uptime behavior.

This commit is contained in:
Kai Lauterbach 2022-05-27 11:59:57 +02:00
parent 7c935946ac
commit 7fdc6d9e23
2 changed files with 13 additions and 6 deletions

View file

@ -72,6 +72,12 @@ void pushToInfluxDB(String device, float sensorValues[]) {
addComma = true; addComma = true;
} }
#ifdef LOG_MILLIS_TO_INFLUXDB
if (true == addComma)
msg += ",";
msg += "timestamp=" + String(millis());
#endif
debug(msg); debug(msg);
do { do {
@ -158,6 +164,12 @@ void pushToInfluxDB(String device, float sensorValues[]) {
_writePoint(); _writePoint();
} }
#ifdef LOG_MILLIS_TO_INFLUXDB
sensor.clearFields();
sensor.addField("timestamp", millis());
_writePoint();
#endif
} }
void _writePoint() { void _writePoint() {

View file

@ -89,11 +89,6 @@ void showHTMLMain(void)
void hb_webstat_send(void) void hb_webstat_send(void)
{ {
unsigned int timestamp = 0;
for (int i = 0; i < VALUES; i++)
{
timestamp += int(_webUpdater_sensValues[i]) + millis();
}
String msg = hb_ws_msg_start + String msg = hb_ws_msg_start +
hb_ws_msg_temp + hb_ws_msg_temp +
String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) + String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) +
@ -111,7 +106,7 @@ void hb_webstat_send(void)
String(_webUpdater_sensValues[SENSOR_PRESSURE], 2) + String(_webUpdater_sensValues[SENSOR_PRESSURE], 2) +
", " + ", " +
hb_ws_msg_timestamp + hb_ws_msg_timestamp +
String(timestamp) + String(millis()) +
hb_ws_msg_end; hb_ws_msg_end;
httpServer.send(200, "text/html", msg); httpServer.send(200, "text/html", msg);