Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Check serial.available() before trying to read

The Maple API returns an unsigned char from read(), making
the old check for -1 incorrect.
  • Loading branch information...
commit 4eefaaaeff30fd2a9dcea6627364dfc52d8ac76f 1 parent 1c0d64f
@pteichman authored
Showing with 2 additions and 5 deletions.
  1. +2 −5 Midi.cpp
View
7 Midi.cpp
@@ -225,13 +225,10 @@ void Midi::recvByte(int byte)
// Try to read data at serial port & pass anything read to processing function
void Midi::poll(void)
{
- int c;
-
-
// Just keep sucking data from serial port until it runs out, processing
// MIDI messages as we go
- while((c = serial_.read()) != -1) {
- recvByte(c);
+ while(serial_.available() > 0) {
+ recvByte(serial_.read());
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.