License and small improvement for debut
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
// Normal mode command
|
||||
#define COMMAND "FDFCFBFA0800120000006400000004030201"
|
||||
#define PRESENCE_DISTANCE 100
|
||||
#define PRESENCE_DISTANCE 120
|
||||
#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
|
||||
|
||||
@@ -16,6 +16,7 @@ ZigbeeOccupancySensor zbOccupancySensor = ZigbeeOccupancySensor(OCCUPANCY_SENSOR
|
||||
|
||||
bool isPresent = false;
|
||||
unsigned long lastMotionDetected = 0; // time when the last motion was detected
|
||||
unsigned long lastCheck = 0; // time it was checked
|
||||
|
||||
void setup() {
|
||||
initSerial();
|
||||
@@ -101,6 +102,7 @@ void readAndProcessSensorLines() {
|
||||
String distanceStr = line.substring(6);
|
||||
int distance = distanceStr.toInt();
|
||||
bool currentStatus = distance <= PRESENCE_DISTANCE;
|
||||
//Serial.println("Distance " + String(distance) + " | Status:" + String(currentStatus));
|
||||
|
||||
if (currentStatus == 1) {
|
||||
lastMotionDetected = millis();
|
||||
|
||||
Reference in New Issue
Block a user