BlueMicro_HID_Arduino_Library icon indicating copy to clipboard operation
BlueMicro_HID_Arduino_Library copied to clipboard

Cannot set the delay sent between items in queue.

Open bobsupercow opened this issue 3 years ago • 4 comments

Currently using the library, we are unable to set the delay used between items in the queue as they are processed. Using the following code actually results in repeated input of the keycode instead of a single instance each second as expected. Perhaps the delay between queue items is to short for the host to recognize, but it isn't tunable externally to verify via testing.

delay(1000);
bluemicro_hid.keyboardReport(0, keycode);
bluemicro_hid.keyboardRelease();
bluemicro_hid.processQueues(CONNECTION_MODE_USB_ONLY);

Using the following code, which is essentially inserting a false delay and processing the input and release separately, works as expected, with a single keypress processed each second.

delay(1000);
bluemicro_hid.keyboardReport(0, keycode);
bluemicro_hid.processQueues(CONNECTION_MODE_USB_ONLY);
delay(10);
bluemicro_hid.keyboardRelease();
bluemicro_hid.processQueues(CONNECTION_MODE_USB_ONLY);

bobsupercow avatar Jul 28 '22 00:07 bobsupercow

This could be implemented as follows: 1 - set a private variable with default value in the constructor 2 - refactor code to use variable instead of hardcoded delay 3 - add getter/setter methods to update the value if needed.

jpconstantineau avatar Jul 29 '22 15:07 jpconstantineau

Variable is already there Setter is already there

variable isn't used in functions that need it. here, here and here for USB

here, here and here for BLE

jpconstantineau avatar Jul 29 '22 15:07 jpconstantineau

Setter should also be documented in readme

jpconstantineau avatar Jul 29 '22 15:07 jpconstantineau

I just did a release that should address this issue. Let me know if it works. Arduino should pull it in a few hours.

jpconstantineau avatar Jul 29 '22 23:07 jpconstantineau