fix one arg error; add delay to startup in example

This commit is contained in:
Dan Halbert 2020-05-04 15:01:27 -04:00
parent c60e598b13
commit cda65d34d5
2 changed files with 8 additions and 1 deletions

View file

@ -169,7 +169,7 @@ class MIDIService(Service):
if self._message_target_length:
self._pending_realtime = b
else:
self._raw.write(b, self._header)
self._raw.write(b, header=self._header)
else:
if (
0x80 <= data <= 0xBF or 0xE0 <= data <= 0xEF or data == 0xF2

View file

@ -33,6 +33,13 @@ while True:
while not ble.connected:
pass
print("Connected")
# Sleep briefly so client can get ready and send setup
# writes to the MIDIService. 0.5secs was insufficient.
time.sleep(1.0)
# Send one unique NoteOn/Off at the beginning to check that the
# delay is sufficient.
midi.send(NoteOn(20, 99))
midi.send(NoteOff(20, 99))
while ble.connected:
midi.send(NoteOn(44, 120)) # G sharp 2nd octave
time.sleep(0.25)