process luxometer

This commit is contained in:
Martin Donnelly 2016-07-07 11:23:03 +01:00
parent d4ded39cb5
commit fd09c21f8c

View File

@ -28,7 +28,10 @@ bluetest = module.exports = function(options) {
core.processLuxData = function(data) {
var m, e, lux;
var _data = data.toString();
var p = data.lastIndexOf(10);
var l = data.length - (p + 1);
var _data = data.toString('ascii',p + 1, l);
logger.debug(data);
logger.debug(_data);
var wH = _data.slice(-5).split(' ');
@ -119,8 +122,7 @@ bluetest = module.exports = function(options) {
if (typeof options.mac !== 'undefined') {
core.mac = options.mac;
}
else {
} else {
console.log('You need to pass a mac address.');
process.exit(1);
}
@ -139,8 +141,7 @@ bluetest = module.exports = function(options) {
'hciconfig: failed to bring up device ' + hcidev + '. Try running with sudo.');
return;
}
else {
} else {
core.connectGatt();