remove delay on code side
This commit is contained in:
@@ -5,9 +5,8 @@
|
||||
|
||||
// Normal mode command
|
||||
#define COMMAND "FDFCFBFA0800120000006400000004030201"
|
||||
#define PRESENCE_DISTANCE 120
|
||||
#define PRESENCE_DISTANCE 140
|
||||
#define DELAY_STATUS_CHECK 1000 // delay (in ms) between two checks of the presence
|
||||
#define POWER_DELAY 20000 // delay (in ms) until turning off the screen
|
||||
|
||||
// Zigbee
|
||||
#define OCCUPANCY_SENSOR_ENDPOINT_NUMBER 1
|
||||
@@ -112,10 +111,10 @@ void readAndProcessSensorLines() {
|
||||
isPresent = true;
|
||||
bool res = sendZigbeeOnOffCommand(isPresent);
|
||||
Serial.println("Motion detected, turning screen light on");
|
||||
} else if (!currentStatus && isPresent && (millis() - lastMotionDetected >= POWER_DELAY)) {
|
||||
} else if (!currentStatus && isPresent) {
|
||||
isPresent = false;
|
||||
bool res = sendZigbeeOnOffCommand(isPresent);
|
||||
Serial.printf("No motion detected for %d ms, turning light off.\n", POWER_DELAY);
|
||||
Serial.printf("No motion detected, turning light off.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user