License and small improvement for debut
This commit is contained in:
7
LICENSE
Normal file
7
LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2026 chriswin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -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