Devices need pin
This commit is contained in:
parent
9bfd8ce57d
commit
5e6bf8763b
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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) ->
|
||||
|
|
Loading…
Reference in New Issue