SysEx end byte 0xF7 showing as 0 in MIDI library

Hello All,

I’m using an older version of the MIDI library (3.x I believe, which ever comes with IDE 1.6.1) and I’m seeing an issue when reading SysEx messages. The last byte my device sends is an F7, but when I read the message out with a callback the last byte always shows as a 0. I’ve checked and I am not missing any bytes.

Something as simple as:

#include <MIDI.h>


void setup() {

  Serial.begin(115200);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  MIDI.setHandleSystemExclusive(handleSysEx);
  Serial.println("MIDI SysEx Test");

}

void loop() {

  MIDI.read();

}

void handleSysEx(byte* array, byte array_size)
{

  for (int i = 0; i < array_size; i++)
  {
    Serial.print(array[i], HEX);
    Serial.print("\t");
  }
  Serial.println();

}

Which (for example) should this:

F0 0 1 74 6 23 10 0 30 F7

Actually prints this:

F0 0 1 74 6 23 10 0 30 0

I’d like to try the newest version of the library (4.2) but too much has changed and I can’t get a test program working. Some incoming messages have checksum bytes as the second to last byte and I want a way to check if the last byte is a terminating byte (F7) or a check sum… if the F7 appears as a 0 then I can’t be sure as this could be a valid check sum or a data byte in a failed string.

Thanks,
Brian