• I'm not sure what's going on - the code on the puck is executing fine, getting all my correct debug output and callbacks for kb.tap;

    however, the computer is not always detecting the taps properly. I have it currently sending like this:

          kb.tap(kb.KEY.F12, kb.MODIFY.GUI, function() {
           console.log("keys sent"); 
          });
    

    Intending to trigger Win+F12 - it does trigger the hotkey on the computer SOMETIMES. I have to press the button a lot to get it. If I do it myself on a keyboard, no problems - intended application catches the hot key. Not so much on the puck.

    Any ideas?

  • I'm not too sure to be honest - what OS is this on? Windows? And are you on the latest Puck.js firmware?

    What happens if you get it to press just a single key like 'A' - is it reliable? It could be related to the modifier (it's possible it needs 'pressing' first, and not at the same time).

  • Windows 10, latest puck.js firmware as of yesterday.

    It seemed pretty reliable with the a/A examples. Assumingly, for a "press and hold", would I do something like:

          NRF.sendHIDReport([kb.MODIFY.GUI,0,0,0,0­,0,0,0], function() {
            NRF.sendHIDReport([kb.MODIFY.GUI,0,kb.KE­Y.F12,0,0,0,0,0], function() {
              NRF.sendHIDReport([0,0,0,0,0,0,0,0], function() {
               console.log("keys sent");
              });
            });
          });
    
  • So...this (despite causing an an error) "works" for my intended purposes. This is the only thing I've been able to do that makes it work "properly".

          NRF.sendHIDReport([kb.MODIFY.GUI,0,kb.KE­Y.F12,0,0,0,0,0], function() {
          });
          NRF.sendHIDReport([kb.MODIFY.GUI,0,kb.KE­Y.F12,0,0,0,0,0], function() {
            NRF.sendHIDReport([0,0,0,0,0,0,0,0], function() {
              console.log("keys sent");
            });
          });
    

    Error:

    
    Uncaught Error: BLE HID already sending
     at line 138 col 8
          });
           ^
    in function "triggerCommand" called from line 96 col 88
    ...eld': held, 'light': light});
                                  ^
    in function called from system
    

    Have any suggestions on how to improve this so it's not technically broken? lol

  • Great! That's really promising.

    So the first code you posted (that looks good) doesn't work? You basically have to send [kb.MODIFY.GUI,0,kb.KE­Y.F12,0,0,0,0,0] twice?

    In that case, could you just do:

          NRF.sendHIDReport([kb.MODIFY.GUI,0,kb.KE­­Y.F12,0,0­,0,0,0], function() {
            NRF.sendHIDReport([kb.MODIFY.GUI,0,kb.KE­­Y.F12,0,0,0,0,0], function() {
              NRF.sendHIDReport([0,0,0,0,0,0,0,0], function() {
               console.log("keys sent");
              });
            });
          });
    

    You could also try:

          NRF.sendHIDReport([kb.MODIFY.GUI,0,0,0,0­­,0,0,0], function() {
            NRF.sendHIDReport([kb.MODIFY.GUI,0,kb.KE­­Y.F12,0,0,0,0,0], function() {
              NRF.sendHIDReport([kb.MODIFY.GUI,0,0,0,0­,0,0,0], function() {
                NRF.sendHIDReport([0,0,0,0,0,0,0,0], function() {
                  console.log("keys sent");
                });
              });
            });
          });
    

    so: press GUI, press F12, release F12, release GUI

  • The first snippet is something I've already tried - doesn't work consistently. Like my prior attempts, it works "sometimes" - double clicking /usually/ does the proper thing, but not always.

    The second snippet has the same results.

    My "broken" snippet is the only one that works consistently. (but causes an error, funny enough - try/catching the error makes it break again).

    Here's some context for what exactly I'm doing:

    I'm setting up a recording kiosk room thing. I have Open Broadcaster Studio running with some obscure hotkey to Record/Stop that won't trigger anything else (it's now WIN+SHIFT+F11 ... WIN+F12 was the save function in PPT), as I need it to always run in the background.

    Puck.js is great because it can sit wirelessly on a lectern and do everything they need to do without having to touch the mouse/kb of the computer. I've programmed different actions for length of click, double click, clicks with no light, etc...

  • So... here's what I ended up doing (and it works, with no errors!)

            NRF.sendHIDReport([kb.MODIFY.GUI|kb.MODI­FY.SHIFT,0,kb.KEY.F11,0,0,0,0,0], function() {
              setTimeout(function() {
                NRF.sendHIDReport([0,0,0,0,0,0,0,0], function() {
                  console.log("keys sent");
                });
              }, 550);
            });
    

    550 seems to be a good spot for a delay in "ending" the HID report. Different software pick up keyboard actions at different intervals, I guess, so this was good for my specific use case. If the delay is too long, it'll trigger it x many times.

  • Thanks! So you think it's that the key was effectively pressed too quickly? I could add a delay to the 'tap' method on the keyboard if so...

  • I think adding a delay parameter would be a great solution to this for the future.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

puck.js - keyboard "taps" not always accurate/responsive

Posted by Avatar for tako @tako

Actions