diff --git a/examples/APDS-9960_Multi-VL53L0X/APDS-9960_Multi-VL53L0X.ino b/examples/APDS-9960_Multi-VL53L0X/APDS-9960_Multi-VL53L0X.ino index bbc482d..2ff8288 100644 --- a/examples/APDS-9960_Multi-VL53L0X/APDS-9960_Multi-VL53L0X.ino +++ b/examples/APDS-9960_Multi-VL53L0X/APDS-9960_Multi-VL53L0X.ino @@ -14,11 +14,12 @@ #define SENSOR_CNT 5 #define XSHUT_START_PIN 4 //we start with pin 4 because 2 and 3 are interrupt pins (on the nano) #define SENSORS_START_ADDRESS 45 //0x35 next sensor has 0x36, ... -#define DISTANCE_THRESHOLD 75 //if object is closer than this millimeters an hit will be signaled +#define DISTANCE_MAX_THRESHOLD 75 //if object is closer than this millimeters an hit will be signaled +#define DISTANCE_MIN_THRESHOLD 10 #define TIMING_BUDGET 50000 #define TIMING_CONTINOUES 50 #define TIMEOUT 100 -#define VL53L0X_DEBOUNCE 1500 //after a hit distance is messarued after this time of milliseconds again +#define VL53L0X_DEBOUNCE 500 //after a hit distance is messarued after this time of milliseconds again VL53L0X sensors[SENSOR_CNT]; unsigned long sensorsLastHit[SENSOR_CNT]; @@ -41,7 +42,7 @@ unsigned long sensorsLastHit[SENSOR_CNT]; // prevent gesture sensor interrupt when just standing in front of mirror, this will // reduce infrared LED power: // if you use a third party sensor (not SPARKFUN) make sure to set the GGAIN value to GGAIN_1X -// #define DEFAULT_GGAIN GGAIN_2X // was: GGAIN_4X +// #define DEFAULT_GGAIN GGAIN_1X // was: GGAIN_4X // #define DEFAULT_GLDRIVE LED_DRIVE_50MA // was: LED_DRIVE_100MA @@ -80,7 +81,7 @@ void setup() { } // Initalisiert I2C - delay(500); + delay(200); Wire.begin(); Wire.beginTransmission(0x29); @@ -89,12 +90,12 @@ void setup() { for (int i = 0; i < SENSOR_CNT; i++) { digitalWrite(XSHUT_START_PIN + i,HIGH); - delay(500); + delay(50); sensors[i].init(); Serial.print("VL53L0X"); Serial.print(i); Serial.println(" - SetAdress"); - delay(500); + delay(150); sensors[i].setAddress(SENSORS_START_ADDRESS+i); Serial.print("VL53L0X"); Serial.print(i); @@ -166,19 +167,20 @@ void loop() { { if ((curTime - sensorsLastHit[i]) > VL53L0X_DEBOUNCE){ uint16_t curValue = sensors[i].readRangeContinuousMillimeters(); - if (curValue <= DISTANCE_THRESHOLD){ + if ((curValue > DISTANCE_MIN_THRESHOLD)&&(curValue <= DISTANCE_MAX_THRESHOLD)){ Serial.print("VL53L0X"); Serial.print(i); if (sensors[i].timeoutOccurred()) { Serial.print(": TIMEOUT"); } else { - Serial.print(": HIT"); + Serial.print(": HIT -> "); + Serial.print(curValue); sensorsLastHit[i] = curTime; } Serial.println(); } - delay(200); + delay(100); } } diff --git a/examples/APDS-9960_Multi-VL53L1X/APDS-9960_Multi-VL53L1X.ino b/examples/APDS-9960_Multi-VL53L1X/APDS-9960_Multi-VL53L1X.ino index fd29604..952d34c 100644 --- a/examples/APDS-9960_Multi-VL53L1X/APDS-9960_Multi-VL53L1X.ino +++ b/examples/APDS-9960_Multi-VL53L1X/APDS-9960_Multi-VL53L1X.ino @@ -14,7 +14,8 @@ #define SENSOR_CNT 3 #define XSHUT_START_PIN 4 //we start with pin 4 because 2 and 3 are interrupt pins (on the nano) #define SENSORS_START_ADDRESS 53 //0x35 next sensor has 0x36, ... -#define DISTANCE_THRESHOLD 75 //if object is closer than this millimeters an hit will be signaled +#define DISTANCE_MAX_THRESHOLD 100 //if object is closer than this millimeters an hit will be signaled +#define DISTANCE_MIN_THRESHOLD 10 #define DISTANCE_MODE VL53L1X::Long //the sensor supports Short, Mid, Long mode #define TIMING_BUDGET 50000 #define TIMING_CONTINOUES 50 @@ -42,7 +43,7 @@ unsigned long sensorsLastHit[SENSOR_CNT]; // prevent gesture sensor interrupt when just standing in front of mirror, this will // reduce infrared LED power: // if you use a third party sensor (not SPARKFUN) make sure to set the GGAIN value to GGAIN_1X -// #define DEFAULT_GGAIN GGAIN_2X // was: GGAIN_4X +// #define DEFAULT_GGAIN GGAIN_1X // was: GGAIN_4X // #define DEFAULT_GLDRIVE LED_DRIVE_50MA // was: LED_DRIVE_100MA @@ -81,7 +82,7 @@ void setup() { } // Initalisiert I2C - delay(500); + delay(200); Wire.begin(); Wire.beginTransmission(0x29); @@ -90,12 +91,12 @@ void setup() { for (int i = 0; i < SENSOR_CNT; i++) { digitalWrite(XSHUT_START_PIN + i,HIGH); - delay(500); + delay(50); sensors[i].init(); Serial.print("VL53L1X"); Serial.print(i); Serial.println(" - SetAdress"); - delay(500); + delay(150); sensors[i].setAddress(SENSORS_START_ADDRESS+i); Serial.print("VL53L1X"); Serial.print(i); @@ -168,7 +169,7 @@ void loop() { { if ((curTime - sensorsLastHit[i]) > VL53L1X_DEBOUNCE){ int curValue = sensors[i].read(true); - if (curValue <= DISTANCE_THRESHOLD){ + if ((curValue > DISTANCE_MIN_THRESHOLD)&&(curValue <= DISTANCE_MAX_THRESHOLD)){ Serial.print("VL53L1X"); Serial.print(i); if (sensors[i].timeoutOccurred()) { @@ -180,7 +181,7 @@ void loop() { Serial.println(); } - delay(200); + delay(100); } } diff --git a/node_helper.js b/node_helper.js index 7be98f1..7c1963a 100644 --- a/node_helper.js +++ b/node_helper.js @@ -50,7 +50,7 @@ module.exports = NodeHelper.create({ for(var curExptMessage in self.config.devices[curDev].messages){ if(curData.indexOf(curExptMessage) == 0){ for(var curNotification in self.config.devices[curDev].messages[curExptMessage]){ - console.log(self.currentProfilePattern.toString()) + // console.log(self.currentProfilePattern.toString()) if(typeof self.config.devices[curDev].messages[curExptMessage][curNotification].profiles === 'undefined' || self.currentProfilePattern.test(self.config.devices[curDev].messages[curExptMessage][curNotification].profiles)){ if(typeof self.config.devices[curDev].messages[curExptMessage][curNotification].notification !== 'undefined'){ diff --git a/package.json b/package.json index 05ddae5..8551e54 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,16 @@ { "name": "MMM-Serial-Notifications", - "version": "0.0.3", + "version": "0.0.4", "description": "", "main": "MMM-Serial-Notifications.js", "devDependencies": {}, "scripts": { - "postinstall": "node_modules/.bin/electron-rebuild -e ../../node_modules/electron" + "postinstall": "node_modules/.bin/MagicMirror-rebuild" }, "dependencies": { "serialport": "latest", - "electron-rebuild": "^1.2.1" + "electron-rebuild": "latest", + "magicmirror-rebuild": "latest" }, "repository": { "type": "git",