Add a small delay before retrying a packet.
If the first attempt fails, that might indicate the device isn't ready yet to service requests. In that case immediately retrying again isn't the right solution. Adding a small delay seems to increase the success rate, so it's a good idea anyway, regardless of the underlying reason.
This commit is contained in:
parent
a046071ad0
commit
633e8423dc
@ -201,6 +201,7 @@ mares_common_transfer (mares_common_device_t *device, const unsigned char comman
|
||||
return rc;
|
||||
|
||||
// Discard any garbage bytes.
|
||||
serial_sleep (device->port, 100);
|
||||
serial_flush (device->port, SERIAL_QUEUE_INPUT);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user