Avatar for tako

tako

Member since May 2018 • Last active Sep 2018
  • 6 conversations
  • 36 comments

Most recent activity

  • Avatar for tako

    Firmware is cutting edge from Sept 13 2018.

    Basically, I am actually pressing the button a lot as an intensive test. So every press causes an output. I'll remove the console.logs to see if we get the same behavior.

    We've had cases of spontaneous button bricking. Need to reset and re-upload code. Sometimes, after a period of inactivity the button stops responding to clicks despite being shown as connected as a keyboard.

    In the cases where I've been able to get a log of what happens, it's the same set of errors as I've been getting here. This is what lead me to adding the delay between allowed clicks, make sure it's not sending multiple HID reports at once.

  • Avatar for tako

    So, I've been doing more testing. I've upped the delay to in my setTimeout() to 500 - still getting errors.

    Most of them are caught, so it doesn't brick the button:

    caught:{"message":"Got BLE error code 12292","type":"Error","stack":" at line 38 col 8\n      });\n       ^\n"}
    

    Per this error code, I've found this other post: https://devzone.nordicsemi.com/f/nordic-­q-a/6222/stability-in-the-uart-communica­tion-over-ble

    Eventually, the button just gives up entirely, the exception can't be caught...

    Uncaught Error: Got BLE error code 12292
     at line 37 col 10
            });
             ^
    in function called from system
    New interpreter error: FIFO_FULL
    WARNING: jsble_exec_pending: Unknown enum type 46
    WARNING: jsble_exec_pending: Unknown enum type 46
    WARNING: jsble_exec_pending: Unknown enum type 46
    
  • Avatar for tako

    The FIFO_FULL thing might have just been my computer shitting itself. After that moment, I couldn't do anything with the Puck's HID stuff at all, even after re-uploading the firmware. A reboot of the PC fixed it.

    Great - thanks for posting up! Do you think it's worth me updating the HID example to add that 'busy' check?

    I guess it's possible that two keys get sent at more or less the same time in such a way that it's then not possible to send the second NRF.sendHIDReport([0,0,0,0,0,0,0,0] which would have 'released' the key?

    Yeah, that seems to be the case. The keys get sent too fast, which breaks the buffer or something. A simple check like that might be good in the example, yeah. It's odd that I didn't experience any issues until recently though.

  • Avatar for tako

    Here's my current code. Previous versions did not have the "sending" check that this now does. I haven't experienced issues with this version of it.

    console.log(NRF.getAddress());
    console.log("Battery: " + E.getBattery() + " " + Puck.getBatteryPercentage());
    
    var debugText = false;
    
    var kb = require("ble_hid_keyboard");
    NRF.setServices(undefined, { hid : kb.report });
    
    var sending = 0;
    
    function catchButton(e) {
    
      var keyDown = e.state === true;
      var keyUp = e.state === false;
      var click = false;
    
      debug_log(keyDown?"key down" : (keyUp? "keyUp" : "broke"));
    
      if(keyUp) {
        triggerCommand();
      }
    }
    
    function triggerCommand() {
      try {
        if(!sending) {
          sending = 1;
          digitalWrite(LED3,1);
          NRF.sendHIDReport([0,0,99,0,0,0,0,0], function() {
            NRF.sendHIDReport([0,0,0,0,0,0,0,0], function() {
              setTimeout(function() {
                console.log("press");
                digitalWrite(LED3,0);
                sending = 0;
              }, 250);
            });
          });
        }
      } catch (e) {
        console.log("caught:" + JSON.stringify(e));
        digitalWrite(LED3,0);
        digitalWrite(LED1,1);
        setTimeout(function() {
          digitalWrite(LED1,0);
          sending = 0;
        }, 250);
      }
    }
    
    
    setWatch(catchButton, BTN, {repeat:true, debounce:50, edge:'both' });
    
    function debug_log(t) {
      if(debugText) console.log(t);
    }
    
  • in Puck.js, Pixl.js and MDBT42
    Avatar for tako

    more logs:

    press
    Uncaught Error: Got BLE error code 12292
     at line 36 col 8
          });
           ^
    in function called from system
    press
    press
    press
    press
    press
    press
    New interpreter error: FIFO_FULL
    WARNING: jsble_exec_pending: Unknown enum type 46
    WARNING: jsble_exec_pending: Unknown enum type 32
    
  • in Puck.js, Pixl.js and MDBT42
    Avatar for tako

    I just tested with Espruino IDE, and eventually this comes up, which just KILLS the button:

    "Uncaught Error: BLE HID already sending" pointing at the end of a function. After that, the button stops responding to HID stuff.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for tako

    I'm having this odd issue with my pucks (tried 2) where, I guess, for some reason, the puck is repeatedly sending the same key over and over. I've had this issue on 2 separate pucks, and 2 separate PCs, 2 separate Bluetooth dongles.

    This has happened with both Cutting Edge and the last proper v199 release.

    Doesn't happen ALL the time, but often enough where it presents a problem.

    Any ideas?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for tako

    Interestingly enough, I tested again just now and it's working! Weird.

Actions