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)
This commit is contained in:
1 parent
ca7d5d4195
commit
ed93a84448
1 file changed
+1
-1
@@ -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<JSON_MSG_CALC_BUFFER> 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 {
|
||||
|
||||
Reference in new issue
Block a user