Skip to content

Commit

Permalink
dependency updates, fixed typos, rebuilt js files
Browse files Browse the repository at this point in the history
  • Loading branch information
mwittig committed Dec 27, 2016
1 parent d84901d commit 4c07048
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 47 deletions.
4 changes: 2 additions & 2 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plumber = require('gulp-plumber')
coffee = require('gulp-coffee')

gulp.task('default', ->
watch(glob: 'src/**/*.coffee', verbose: true)
.pipe(plumber()) # This will keeps pipes working after error event
watch('src/**/*.coffee', verbose: true)
.pipe(plumber()) # This will keep pipes working after error event
.pipe(coffee(bare: yes))
.pipe(gulp.dest('lib'))
)
52 changes: 26 additions & 26 deletions lib/board.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var Board, Promise, assert, events, rfcontrol, settled,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

Promise = require('bluebird');

Expand All @@ -15,8 +15,8 @@ settled = function(promise) {
return Promise.settle([promise]);
};

Board = (function(_super) {
__extends(Board, _super);
Board = (function(superClass) {
extend(Board, superClass);

Board.HIGH = 1;

Expand All @@ -35,8 +35,8 @@ Board = (function(_super) {
Board.prototype.ready = false;

function Board(driver, driverOptions) {
this._waitForAcknowledge = __bind(this._waitForAcknowledge, this);
this._onAcknowledge = __bind(this._onAcknowledge, this);
this._waitForAcknowledge = bind(this._waitForAcknowledge, this);
this._onAcknowledge = bind(this._onAcknowledge, this);
var GpioDriver, SerialPortDriver;
assert(driver === "serialport" || driver === "gpio");
switch (driver) {
Expand Down Expand Up @@ -90,9 +90,9 @@ Board = (function(_super) {
})(this));
}

Board.prototype.connect = function(timeout, retries) {
this.timeout = timeout != null ? timeout : 5 * 60 * 1000;
this.retries = retries != null ? retries : 3;
Board.prototype.connect = function(timeout1, retries1) {
this.timeout = timeout1 != null ? timeout1 : 5 * 60 * 1000;
this.retries = retries1 != null ? retries1 : 3;
return this.pendingConnect = this.driver.connect(timeout, retries);
};

Expand Down Expand Up @@ -159,9 +159,9 @@ Board = (function(_super) {
Board.prototype.writeAndWait = function(data) {
return this._lastAction = settled(this._lastAction).then((function(_this) {
return function() {
return Promise.all([_this.driver.write(data), _this._waitForAcknowledge()]).then(function(_arg) {
var result, _;
_ = _arg[0], result = _arg[1];
return Promise.all([_this.driver.write(data), _this._waitForAcknowledge()]).then(function(arg) {
var _, result;
_ = arg[0], result = arg[1];
return result;
});
};
Expand Down Expand Up @@ -257,15 +257,15 @@ Board = (function(_super) {
};

Board.prototype.rfControlSendPulses = function(pin, repeats, pulseLengths, pulses) {
var i, pl, pulseLengthsArgs, _i, _len;
var i, j, len, pl, pulseLengthsArgs;
assert(typeof pin === "number", "pin should be a number");
assert(Array.isArray(pulseLengths), "pulseLengths should be an array");
assert(pulseLengths.length <= 8, "pulseLengths.length should be <= 8");
assert(typeof pulses === "string", "pulses should be a string");
pulseLengthsArgs = "";
i = 0;
for (_i = 0, _len = pulseLengths.length; _i < _len; _i++) {
pl = pulseLengths[_i];
for (j = 0, len = pulseLengths.length; j < len; j++) {
pl = pulseLengths[j];
pulseLengthsArgs += " " + pl;
i++;
}
Expand All @@ -286,9 +286,9 @@ Board = (function(_super) {

Board.prototype._waitForAcknowledge = function() {
return this._onAcknowledge().then((function(_this) {
return function(_arg) {
return function(arg) {
var args, cmd;
cmd = _arg.cmd, args = _arg.args;
cmd = arg.cmd, args = arg.args;
switch (cmd) {
case 'ERR':
throw new Error(args[0]);
Expand Down Expand Up @@ -322,33 +322,33 @@ Board = (function(_super) {
};

Board.prototype._handleRFControl = function(cmd, args) {
var a, info, strSeq, _i, _len, _ref;
var a, info, j, len, ref, strSeq;
if (!(args.length === 10 && args[0] === 'receive')) {
console.log("Unknown RF response \"" + (args.join(" ")) + "\"");
return;
}
strSeq = args[1];
_ref = args.slice(2, 10);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
ref = args.slice(2, 10);
for (j = 0, len = ref.length; j < len; j++) {
a = ref[j];
strSeq += " " + a;
}
info = rfcontrol.prepareCompressedPulses(strSeq);
this._emitReceive(info);
};

Board.prototype.provessExternalReceive = function(pulseLengths, pulses) {
Board.prototype.processExternalReceive = function(pulseLengths, pulses) {
var info;
info = rfcontrol.sortCompressedPulses(pulseLengths, pulses);
this._emitReceive(info);
};

Board.prototype._emitReceive = function(info) {
var r, results, _i, _len;
var j, len, r, results;
this.emit('rfReceive', info);
results = rfcontrol.decodePulses(info.pulseLengths, info.pulses);
for (_i = 0, _len = results.length; _i < _len; _i++) {
r = results[_i];
for (j = 0, len = results.length; j < len; j++) {
r = results[j];
this.emit('rf', r);
}
};
Expand Down
8 changes: 4 additions & 4 deletions lib/driver/gpio.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var GpioDriver, Promise, events, path, readline, spawn,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

events = require('events');

Expand All @@ -12,8 +12,8 @@ readline = require('readline');

path = require('path');

GpioDriver = (function(_super) {
__extends(GpioDriver, _super);
GpioDriver = (function(superClass) {
extend(GpioDriver, superClass);

function GpioDriver(protocolOptions) {
this.protocolOptions = protocolOptions;
Expand Down
8 changes: 4 additions & 4 deletions lib/driver/serialport.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Promise, SerialPort, SerialPortDriver, events, serialport,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

events = require('events');

Expand All @@ -12,8 +12,8 @@ Promise = require('bluebird');

Promise.promisifyAll(SerialPort.prototype);

SerialPortDriver = (function(_super) {
__extends(SerialPortDriver, _super);
SerialPortDriver = (function(superClass) {
extend(SerialPortDriver, superClass);

function SerialPortDriver(protocolOptions) {
var openImmediately;
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@
"url": "https://github.com/pimatic/homeduinojs/issues"
},
"dependencies": {
"bluebird": "~2.9.14",
"otaat-repl": "^1.0.1",
"rfcontroljs": "~0.0.57",
"bluebird": "~3.4.7",
"otaat-repl": "^1.0.2",
"rfcontroljs": "~0.0.58",
"serialport": "~2.0.6"
},
"devDependencies": {
"colors": "^0.6.2",
"gulp": "~3.8.6",
"gulp-coffee": "~2.1.1",
"gulp-plumber": "~0.6.4",
"gulp-watch": "~0.6.9"
"coffee-script": "^1.12.2",
"colors": "^1.1.2",
"gulp": "~3.9.1",
"gulp-coffee": "~2.3.3",
"gulp-plumber": "~1.1.0",
"gulp-watch": "~4.3.11"
}
}
2 changes: 1 addition & 1 deletion src/driver/gpio.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GpioDriver extends events.EventEmitter
@emit 'ready', {tag: 'gpio'}
return
@emit('line', line)
)
)
@vhduino.stdout.on('data', (data) => @emit('data', data.toString()) )
@vhduino.on('close', (code) => @emit 'close' )
@vhduino.on('error', (error) => @emit('error', error) )
Expand Down
4 changes: 2 additions & 2 deletions src/driver/serialport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SerialPortDriver extends events.EventEmitter
return @serialPort.openAsync().then( =>
resolver = null

# setup data listner
# setup data listener
@serialPort.on("data", (data) =>
# Sanitize data
line = data.replace(/\0/g, '').trim()
Expand All @@ -47,7 +47,7 @@ class SerialPortDriver extends events.EventEmitter
)

return new Promise( (resolve, reject) =>
# write ping to force reset (see data listerner) if device was not reseted probably
# write ping to force reset (see data listener) if device was not reset probably
Promise.delay(1000).then( =>
@serialPort.writeAsync("PING\n").catch(reject)
).done()
Expand Down

0 comments on commit 4c07048

Please sign in to comment.