arduino-libraries/MIDIUSB

Avoid long time execution when sending midiusb packet

YruamaLairba opened this issue · 5 comments

I just discovered that sometimes, sending a midiusb packet take more than 250ms. Typically this happen when the Arduino is connected to the computer, but no app to get the midi data. Is there a simple way to avoid or reduce this delay from the arduino side ?

Hi @YruamaLairba ,
probably what you are seeing is the USB_send timeout if the interface is not yet configured.
Do you also experience the long delay if you open the serial port?

Yes, the long delay is here when the serial port is open. This how i report the 250ms delay. The USB_send timeout seems a good way, can you tell me more about it or indicate some documentation ?

Related to #46.

Edit - I was having this issue, mostly due to my use of an outdated core for production devices. I backported the timeout counter from usb.send() from the current core and I'm no longer experiencing this issue.

There's an easy way to check, if the port is ready. See my reply here: #46