1
0
Fork 0

hidjoystick: update description

master
Erik Andresen 2020-04-28 06:47:14 +02:00
parent cfd5da6da7
commit aff7d6eb84
2 changed files with 3 additions and 2 deletions

View File

@ -1518,7 +1518,7 @@
"shortName": "Joystick",
"icon": "app.png",
"version":"0.01",
"description": "Use the accelerometer as Joystick with 5 buttons.",
"description": "Emulate a 2 Axis/5 Button Joystick using the accelerometer as stick input and buttons 1-3, touch left and touch right.",
"tags": "bluetooth",
"storage": [
{"name":"hidjoystick.app.js","url":"app.js"},

View File

@ -1,3 +1,4 @@
const reportIdJs=3;
var sendInProgress = false; // Only send one message at a time, do not flood
const sendHid = function (x, y, btn1, btn2, btn3, btn4, btn5, cb) {
@ -5,7 +6,7 @@ const sendHid = function (x, y, btn1, btn2, btn3, btn4, btn5, cb) {
const buttons = (btn5<<4) | (btn4<<3) | (btn3<<2) | (btn2<<1) | (btn1<<0);
if (!sendInProgress) {
sendInProgress = true;
NRF.sendHIDReport([3, buttons, x, y], () => {
NRF.sendHIDReport([reportIdJs, buttons, x, y], () => {
sendInProgress = false;
if (cb) cb();
});