3 Commits

Author SHA1 Message Date
zyphlar
df4fa8fb5b Fix all_on and all_off error
sendFeatureReport always needs two arguments, even if one is null (0x00)

See C++ source here for future development reference: 87cf2d92c7/lib/usb_relay_lib.c
2018-08-31 13:26:59 -07:00
Dana Woodman
4a6720e525 0.0.4 2018-07-23 13:21:02 -07:00
Dana Woodman
b0da1b68e6 Fix package import 2018-07-23 13:18:46 -07:00
3 changed files with 9 additions and 6 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "easy-usb-relay", "name": "easy-usb-relay",
"version": "0.0.3", "version": "0.0.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,14 +1,14 @@
{ {
"name": "easy-usb-relay", "name": "easy-usb-relay",
"version": "0.0.3", "version": "0.0.4",
"description": "A simple USB relay support library", "description": "A simple USB relay support library",
"main": "src/relay.js", "main": "src/relays.js",
"scripts": { "scripts": {
"test": "jest" "test": "jest"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "github.com/danawoodman/usbrelay" "url": "github.com/danawoodman/easy-usb-relay"
}, },
"keywords": [ "keywords": [
"usb", "usb",

View File

@@ -69,14 +69,17 @@ class Board {
} }
allOn() { allOn() {
this.trigger([ALL_ON]) this.trigger([ALL_ON, 0])
} }
allOff() { allOff() {
this.trigger([ALL_OFF]) this.trigger([ALL_OFF, 0])
} }
trigger(state) { trigger(state) {
if (state.length != 2) {
throw new Error('easy-usb-relay library error: exactly two arguments required for trigger function.')
}
this.logState() this.logState()
this.board.sendFeatureReport(state) this.board.sendFeatureReport(state)
} }