From a1d00f58ba4c37fcb1c91617c7cfdb4ddf450467 Mon Sep 17 00:00:00 2001 From: Edward Vielmetti Date: Wed, 18 Mar 2015 10:44:56 -0400 Subject: [PATCH] naming fix luxometer -> lux, luxNotify -> LuxNotify --- hardware/sensorTag/79-sensorTag.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hardware/sensorTag/79-sensorTag.js b/hardware/sensorTag/79-sensorTag.js index 8f42a94d..0351c5e8 100644 --- a/hardware/sensorTag/79-sensorTag.js +++ b/hardware/sensorTag/79-sensorTag.js @@ -30,6 +30,7 @@ function sensorTagNode(n) { this.accelerometer = n.accelerometer; this.magnetometer = n.magnetometer; this.gyroscope = n.gyroscope; + this.lux = n.lux; // supported in sensortag 2 this.keys = n.keys; if (this.uuid === "") { @@ -87,6 +88,12 @@ function sensorTagNode(n) { msg.payload = {'x': x, 'y': y, 'z': z}; node.send(msg); }); + sensorTag.enableLux(function(){}); + sensorTag.on('LuxChange', function(lux){ // should be luxChange + var msg = {'topic': node.topic + '/lux'}; + msg.payload = {'lux': lux}; + node.send(msg); + }); sensorTag.on('simpleKeyChange', function(left, right){ var msg = {'topic': node.topic + '/keys'}; msg.payload = {'left': left, 'right': right}; @@ -133,6 +140,11 @@ function enable(node) { } else { node.stag.unnotifyGyroscope(function() {}); } + if (node.lux) { + node.stag.notifyLux(function() {}); + } else { + node.stag.unnotifyLux(function() {}); + } if (node.keys) { node.stag.notifySimpleKey(function() {}); } else {