Skip to content

Commit

Permalink
changed how bluetooth is evaluated
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Forman committed Jan 21, 2019
1 parent 82f3226 commit ef0542e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mapping/ds4.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ exports._parse = function(data,chg) {
}

exports._getMode = function(dev) {
return dev.release==0?"bluetooth":"usb";
if (dev.release==0) { return "bluetooth" }
if (dev.path.toLowerCase().indexOf("bluetooth") > -1) { return "bluetooth" }
return "usb"
}

exports.setLed = function(r, g, b, flashOn, flashOff) {
Expand Down Expand Up @@ -96,6 +98,6 @@ function ds4Write(dev) {
}
//let s = ''; msg.forEach(function(e) { s += "0x"+(e?e.toString(16):'00')+", "; }); console.log(s.substr(0,s.length-2));
msg.shift(); //Remove 0xa2 at start.
dev.write(msg, true);
dev.write(msg);
}
}

0 comments on commit ef0542e

Please sign in to comment.