-
• #2
By the way, does 1v99 release preceed 1v99 cutting edge, or is it the other way around?
-
• #3
Ok, just saw this other thread about exact same error: http://forum.espruino.com/conversations/325524/
I can confidently say that this doesn't happen in 1v99 release...
-
• #4
does 1v99 release preceed 1v99 cutting edge, or is it the other way around?
Yes - 1v99 is older than the cutting edge.
So looking at the code, you're not actually calling
tap
until you've had the callback to the last one? As you say, that sure seems like it should be fine. I'll take a look. -
• #5
Ok, just tried this, with the
console.log
on Serial... If you try:console.log("[tap]"); kb.tap(..., function() { console.log("[tap done]"); ... });
both places you call tap then you can see that you can definitely get it into a position where you're calling
.tap
before the last one has finished, which will cause an error:[tap] [tap done] Starting kbTimer Clearing kbTimer until finished typing [tap] e.state: true e.time: 1538038837.98822593688 e.lastTime: 1538038837.25543785095 duration: 0.73278808593 [tap done] Starting kbTimer Clearing kbTimer until finished typing [tap] e.state: false e.time: 1538038838.10324668884 e.lastTime: 1538038837.98822593688 duration: 0.11502075195 [tap] [Short press] Uncaught Error: BLE HID already sending at line 1 col 55 NRF.sendHIDReport([0,0,0,0,0,0,0,0],function(){a&&a()}) ^ in function called from system [tap done]
However, no
BLE error code 12292
.What I'm pretty sure is happening is a few things are all conspiring against you:
- After some inactivity, Espruino will now enter a low-bandwidth, low-power mode. (can be fixed with
NRF.setConnectionInterval
as that post you linked shows - First thing you do after a button press is print a load of stuff over Bluetooth. This uses up most of the available TX slots (apart from one for HID)
- The HID report is sent - all TX slots are used up, but that's fine
- Not all of the TX packets get sent the next time (possibly because of negotiation to exit the low power mode)
- Espruino gets notified that TX packets were sent - it has no way of knowing which ones, so it assumes HID has been sent and tells your code.
- Your code sends another HID packet, but it fails this time because there are no free TX slots
Basically there's not much I can do about it apart from to only send one TX packet at a time instead of 5, reducing Espruino's TX speed by a factor of 5 - so that is what I've done. Hopefully if you try a cutting edge build now it'll be fixed.
I don't think on the whole people will notice too much as it's really the RX speed that's the killer.
- After some inactivity, Espruino will now enter a low-bandwidth, low-power mode. (can be fixed with
Hi Gordon,
Here's the problem I found with 1v99 cutting edge that I mentioned in my previous post.
It only happens in 1v99 cutting edge and the exact same code works perfectly fine in 1v99 release.
Basically, I run the code below on my puck to make it act as HID keyboard and type some string on a long press and [Enter] on a short press.
Short press creates no problems, so I'll ignore that scenario.
Long press produces the following results on 1v99 release (in IDE console):
Exact same code on 1v99 cutting edge does the following
You may notice that there is couple of commented out chunks of code that uses NRF.sendHIDReport() for typing instead of kb.tap(). I tried it as well and had the same error, but it looked something like this:
Kind regards :)