Fix one condition where read returns a large negative integer instead of the correct byte value.
Fix a second condition where checkFromBuffer returns a negative number and triggers a serial read before the buffer is depleted.
For example, if 0xFE is read from the buffer, Setting an integer equal to the buffer value results in 0xFFFFFFFE, which is out of the byte range.
Fix one condition where read returns a large negative integer instead of the correct byte value. Fix a second condition where checkFromBuffer returns a negative number and triggers a serial read before the buffer is depleted.
For example, if 0xFE is read from the buffer, Setting an integer equal to the buffer value results in 0xFFFFFFFE, which is out of the byte range.