hidjoystick: update description
parent
cfd5da6da7
commit
aff7d6eb84
|
|
@ -1518,7 +1518,7 @@
|
||||||
"shortName": "Joystick",
|
"shortName": "Joystick",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.01",
|
"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",
|
"tags": "bluetooth",
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"hidjoystick.app.js","url":"app.js"},
|
{"name":"hidjoystick.app.js","url":"app.js"},
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
const reportIdJs=3;
|
||||||
var sendInProgress = false; // Only send one message at a time, do not flood
|
var sendInProgress = false; // Only send one message at a time, do not flood
|
||||||
|
|
||||||
const sendHid = function (x, y, btn1, btn2, btn3, btn4, btn5, cb) {
|
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);
|
const buttons = (btn5<<4) | (btn4<<3) | (btn3<<2) | (btn2<<1) | (btn1<<0);
|
||||||
if (!sendInProgress) {
|
if (!sendInProgress) {
|
||||||
sendInProgress = true;
|
sendInProgress = true;
|
||||||
NRF.sendHIDReport([3, buttons, x, y], () => {
|
NRF.sendHIDReport([reportIdJs, buttons, x, y], () => {
|
||||||
sendInProgress = false;
|
sendInProgress = false;
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue