mirror of
https://gitlab.silvrtree.co.uk/martind2000/bluetest.git
synced 2025-01-26 20:56:17 +00:00
process luxometer
This commit is contained in:
parent
d4ded39cb5
commit
fd09c21f8c
11
lib/index.js
11
lib/index.js
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user