From ed93a844486d1afe1a813426ad0d263610d48622 Mon Sep 17 00:00:00 2001 From: "Carlos Duarte Do Nascimento (Chester)" Date: Tue, 13 Aug 2019 00:56:39 -0400 Subject: [PATCH] Avoid spam of buffer message in hcsr501 (#442) * Avoid printing the buffer message on every iteration of the main loop * Print message when the motion starts (to match the motion end one) --- main/ZsensorHCSR501.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/ZsensorHCSR501.ino b/main/ZsensorHCSR501.ino index 1cea157..e48bee0 100644 --- a/main/ZsensorHCSR501.ino +++ b/main/ZsensorHCSR501.ino @@ -36,7 +36,6 @@ void setupHCSR501() { void MeasureHCSR501(){ if (millis() > TimeBeforeStartHCSR501) {//let time to init the PIR sensor - trc(F("Creating HCSR501 buffer")); const int JSON_MSG_CALC_BUFFER = JSON_OBJECT_SIZE(1); StaticJsonBuffer jsonBuffer; JsonObject& HCSR501data = jsonBuffer.createObject(); @@ -49,6 +48,7 @@ void MeasureHCSR501(){ if (pirState == LOW) { //turned on HCSR501data.set("hcsr501", "true"); + trc(F("HC SR501 Motion started")); pirState = HIGH; } } else {