Fix driver-related issues
This commit is contained in:
parent
78db5f3a56
commit
29515adea7
|
@ -67,7 +67,7 @@ module.exports = class Robot
|
||||||
for n, device of @devices
|
for n, device of @devices
|
||||||
Logger.info "Starting device '#{ device.name }'..."
|
Logger.info "Starting device '#{ device.name }'..."
|
||||||
device.start()
|
device.start()
|
||||||
this[device.name] = device
|
self[device.name] = device
|
||||||
|
|
||||||
@requireAdaptor = (adaptorName, connection) =>
|
@requireAdaptor = (adaptorName, connection) =>
|
||||||
if @adaptors[adaptorName]?
|
if @adaptors[adaptorName]?
|
||||||
|
@ -89,17 +89,17 @@ module.exports = class Robot
|
||||||
registerAdaptor: (args...) ->
|
registerAdaptor: (args...) ->
|
||||||
self.registerAdaptor(args...)
|
self.registerAdaptor(args...)
|
||||||
|
|
||||||
requireDriver: (driverName, device) =>
|
@requireDriver = (driverName, device) =>
|
||||||
if @drivers[driverName]?
|
if @drivers[driverName]?
|
||||||
if typeof @drivers[driverName] is 'string'
|
if typeof @drivers[driverName] is 'string'
|
||||||
@drivers[driverName] = require(@drivers[driverName]).driver(driver: driver)
|
@drivers[driverName] = require(@drivers[driverName]).driver(device: device)
|
||||||
else
|
else
|
||||||
require("cylon-#{driverName}").register(this)
|
require("cylon-#{driverName}").register(this)
|
||||||
@drivers[driverName] = require("cylon-#{driverName}").driver(driver: driver)
|
@drivers[driverName] = require("cylon-#{driverName}").driver(device: device)
|
||||||
|
|
||||||
return @drivers[driverName]
|
return @drivers[driverName]
|
||||||
|
|
||||||
@requireDriver = (args...) ->
|
requireDriver: (args...) ->
|
||||||
self.requireDriver(args...)
|
self.requireDriver(args...)
|
||||||
|
|
||||||
@registerDriver: (moduleName, driverName) =>
|
@registerDriver: (moduleName, driverName) =>
|
||||||
|
|
Loading…
Reference in New Issue