X-Git-Url: http://git.tdb.fi/?p=model-railway-devices.git;a=blobdiff_plain;f=arducontrol%2Fs88.c;h=bd53deb72f55e252e2c88db1ed609e42fa896bae;hp=142455a13ae551e1cb724e1a6b976e231d35e1ba;hb=f0f49dd7ecb27635906557267a733dd8bdb8a9f7;hpb=5d6f425971266accc2e3d1c6de96a0ba031adb8d diff --git a/arducontrol/s88.c b/arducontrol/s88.c index 142455a..bd53deb 100644 --- a/arducontrol/s88.c +++ b/arducontrol/s88.c @@ -28,8 +28,11 @@ void s88_init(void) 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];