remove delay on code side

This commit is contained in:
2026-02-26 20:49:23 +01:00
parent 063cc8aae1
commit e120900a01

View File

@@ -5,9 +5,8 @@
// Normal mode command // Normal mode command
#define COMMAND "FDFCFBFA0800120000006400000004030201" #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 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 // Zigbee
#define OCCUPANCY_SENSOR_ENDPOINT_NUMBER 1 #define OCCUPANCY_SENSOR_ENDPOINT_NUMBER 1
@@ -112,10 +111,10 @@ void readAndProcessSensorLines() {
isPresent = true; isPresent = true;
bool res = sendZigbeeOnOffCommand(isPresent); bool res = sendZigbeeOnOffCommand(isPresent);
Serial.println("Motion detected, turning screen light on"); Serial.println("Motion detected, turning screen light on");
} else if (!currentStatus && isPresent && (millis() - lastMotionDetected >= POWER_DELAY)) { } else if (!currentStatus && isPresent) {
isPresent = false; isPresent = false;
bool res = sendZigbeeOnOffCommand(isPresent); 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");
} }
} }
} }