naming fix

luxometer -> lux, luxNotify -> LuxNotify
This commit is contained in:
Edward Vielmetti 2015-03-18 10:44:56 -04:00
parent 538b210008
commit a1d00f58ba

View File

@ -30,6 +30,7 @@ function sensorTagNode(n) {
this.accelerometer = n.accelerometer; this.accelerometer = n.accelerometer;
this.magnetometer = n.magnetometer; this.magnetometer = n.magnetometer;
this.gyroscope = n.gyroscope; this.gyroscope = n.gyroscope;
this.lux = n.lux; // supported in sensortag 2
this.keys = n.keys; this.keys = n.keys;
if (this.uuid === "") { if (this.uuid === "") {
@ -87,6 +88,12 @@ function sensorTagNode(n) {
msg.payload = {'x': x, 'y': y, 'z': z}; msg.payload = {'x': x, 'y': y, 'z': z};
node.send(msg); 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){ sensorTag.on('simpleKeyChange', function(left, right){
var msg = {'topic': node.topic + '/keys'}; var msg = {'topic': node.topic + '/keys'};
msg.payload = {'left': left, 'right': right}; msg.payload = {'left': left, 'right': right};
@ -133,6 +140,11 @@ function enable(node) {
} else { } else {
node.stag.unnotifyGyroscope(function() {}); node.stag.unnotifyGyroscope(function() {});
} }
if (node.lux) {
node.stag.notifyLux(function() {});
} else {
node.stag.unnotifyLux(function() {});
}
if (node.keys) { if (node.keys) {
node.stag.notifySimpleKey(function() {}); node.stag.notifySimpleKey(function() {});
} else { } else {