void s88_check(void)
{
+ /* Check remaining read count before ringbuffer fill. If it is zero, no
+ more bytes are arriving in the buffer and the contents can be sent out. */
+ uint8_t rc = s88_read_count;
uint8_t count = ringbuffer_fill(s88_buffer);
- if(count>=4 || (count>0 && !s88_read_count))
+ if(count>=4 || (count>0 && !rc))
{
uint8_t reply[10];
- uint8_t i;
reply[0] = S88_DATA;
reply[1] = s88_out_index;
- for(i=0; i<count; ++i)
+ for(uint8_t i=0; i<count; ++i)
reply[2+i] = ringbuffer_pop(s88_buffer);
interface_send(reply, 2+count);
s88_out_index += count;