Skip to content

Commit

Permalink
* Added board config option to set baudrate
Browse files Browse the repository at this point in the history
* Fixed error on getBoard() function
  • Loading branch information
mwittig committed Dec 29, 2015
1 parent 4f6f13f commit 2eed268
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion board-manager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ module.exports = (env) ->
createBoard: (options) ->
switch options.boardType || 'arduino'
when 'arduino' then (
if options.port? and options.baudrate?
SerialPort = require('serialport').SerialPort
options.port = new SerialPort(options.port, {baudrate: options.baudrate})
@board = new BoardWrapper(_.assign({}, options, {repl: false}))
)
when 'raspi-io' then (
Expand Down Expand Up @@ -109,5 +112,5 @@ module.exports = (env) ->
return board
else
error = new Error "Board not found"
_base.error error
@_base.error error
throw error
10 changes: 7 additions & 3 deletions johnny-five-config-schema.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ module.exports = {
description: "Path or name of device port"
type: "string"
default: ""
baudrate:
description: "The baudrate to use for serial communication"
type: "number"
required: false
token:
description: "Particle token. Only required for particle-io board type"
type: "string"
default: ""
required: false
deviceId:
description: "Particle devicde id. Only required for particle-io board type"
description: "Particle device id. Only required for particle-io board type"
type: "string"
default: ""
required: false



Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
},
"optionalDependencies": {
"particle-io": "^0.12.0",
"raspi-io": "^5.0.0"
"raspi-io": "^5.1.0",
"serialport": "^2.0.5"
},
"peerDependencies": {
"pimatic": "0.8.*"
Expand Down

0 comments on commit 2eed268

Please sign in to comment.