Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not launching sysex callback with specific message lengths #168

Open
sanotronics opened this issue Aug 26, 2020 · 3 comments
Open

Not launching sysex callback with specific message lengths #168

sanotronics opened this issue Aug 26, 2020 · 3 comments
Labels
SysEx Issue relates to System Exclusive messages USB-MIDI Issue relates to USB-MIDI transport

Comments

@sanotronics
Copy link

sanotronics commented Aug 26, 2020

Hi!

I am using this library in this project: https://gitlab.com/yaeltex/ytx-controller/-/tree/unusedConfigUpdate

SysEx handling is done in IO_PROTOCOL.ino and configuration structs are defined in headers/types.h

I am sending a sysex configuration to the controller board, each sysex message being a different component to configure, with the BLOCK byte being what kind of component is or if it is a general configuration, and the SECTION bytes being indexes to encoder 1, 2, 3 or button 13 an so on.

I've been using this (almost) flawlessly and I had a good system set up and working, until I decided it'd be a nice idea, 2 weeks before shipping the first units sold for this kind of controllers, to set some extra bytes in the configuration for future implementation of features.

The branch unusedConfigUpdate is the one where I am testing these changes.

There is a timer firing MIDI.read() 2 times per millisecond

Now, I am receiving 2 kind of blocks, the larger ones, Configuration (272 bytes) and Encoders (74 bytes), perfectly, but when the configurator sends the digital or analog blocks (both 47 bytes), the first time through, the sysex callback doesn't seem to be launching.

I have a print right at the beginning of this callback, printing the received message, and I see nothing.

The configurator tool sends 3 times the same message, and as it's not getting an ACK message from the board, it gives up.

These 3 messages are going out of the configurator for sure, I sniffed with the macOS midi monitor, and I see them.

If I send the configuration a second time, without changing anything, just hit "Send" a second time, first I see the 3 messages that were sent before as if they were held somewhere, and then I see the new configuration get through complete. So the second time, all the messages arrive perfectly.

I am clueless, I was using until now the 4.4 version of the library with the USB transport, and just to test, I have updated now to 5.0.2, but the same thing happens (I have a different bug with the update sending sysex, some messages go out shorter than they should, but it's something else)

If anything like this ever happened to anyone, I'll apreciate whatever clue you can throw at me.

If you need further info, please let me know.

Thanks!

@sanotronics
Copy link
Author

sanotronics commented Aug 26, 2020

Ok, I did some testing.

I tried sending the configuration messages using PocketMIDI, just pasting the sysex bytes I want my board to receive as configuration messages.

Like I said, my analog and digital configuration is 47 bytes long, total.

With PocketMIDI i can edit this messages erasing and adding bytes.

It turns out that if the message is 46, 47 or 48 bytes long, I have to send it 4 times, and only when the 4th message is sent, the sysex callback is launched and i see the 4 messages printed out.

I tried from 30 bytes to 45, all messages launch the callback correctly.

Anything from 49 bytes to 93 bytes (44 bytes distance), launch the callback correctly as well.

A 94, 95 or 96-byte message, requires 2 messages to launch the callback, and when it launches, both messages get printed out.

97 to 141 (44 bytes distance) messages work fine, but if until here you found it weird, wait for the message with 142 bytes.

It seems that you have to send 2 messages, and with the second, only one callback is triggered. Then you send one more message and the callback is triggered once, and then with the following message you get 2 callbacks launched.

I am guessing some sort of USB transport bug?

@franky47 what do you think?

@sanotronics sanotronics changed the title [question] Not launching sysex callback [question] Not launching sysex callback with specific sysex message lengths Aug 26, 2020
@sanotronics sanotronics changed the title [question] Not launching sysex callback with specific sysex message lengths [question] Not launching sysex callback with specific message lengths Aug 26, 2020
@sanotronics sanotronics changed the title [question] Not launching sysex callback with specific message lengths Not launching sysex callback with specific message lengths Aug 26, 2020
@lathoub lathoub added SysEx Issue relates to System Exclusive messages USB-MIDI Issue relates to USB-MIDI transport labels Sep 19, 2020
@lathoub
Copy link
Collaborator

lathoub commented Sep 19, 2020

Is this the same issue as #170 ?

@sanotronics
Copy link
Author

Hi @lathoub !

I would think they are related, but this one is on reception and #170 is when sending a message out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SysEx Issue relates to System Exclusive messages USB-MIDI Issue relates to USB-MIDI transport
Projects
None yet
Development

No branches or pull requests

2 participants