From 5e6bf8763bd35275c2142d155b3e07b808b0a7f9 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Fri, 25 Oct 2013 20:29:11 -0700 Subject: [PATCH] Devices need pin --- dist/device.js | 8 +++++++- src/device.coffee | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dist/device.js b/dist/device.js index 072c8a1..09f7254 100644 --- a/dist/device.js +++ b/dist/device.js @@ -28,13 +28,19 @@ this.self = this; this.robot = opts.robot; this.name = opts.name; + this.pin = opts.pin; this.connection = this.determineConnection(opts.connection) || this.defaultConnection(); this.driver = this.requireDriver(opts.driver); this.addCommands(this.driver); } Device.prototype.start = function() { - Logger.info("Starting driver " + this.driver.name); + var msg; + msg = "Starting device '" + this.name + "'"; + if (this.pin != null) { + msg += " on pin " + this.pin; + } + Logger.info(msg); return this.driver.start(); }; diff --git a/src/device.coffee b/src/device.coffee index f4492ca..b378b96 100644 --- a/src/device.coffee +++ b/src/device.coffee @@ -16,12 +16,15 @@ module.exports = class Device extends EventEmitter @self = this @robot = opts.robot @name = opts.name + @pin = opts.pin @connection = @determineConnection(opts.connection) or @defaultConnection() @driver = @requireDriver(opts.driver) @addCommands(@driver) start: -> - Logger.info "Starting driver #{ @driver.name }" + msg = "Starting device '#{ @name }'" + msg += " on pin #{@pin}" if @pin? + Logger.info msg @driver.start() determineConnection: (c) ->