Wait after changing the serial line settings.
Without the delay, the communication immediately fails. We receive the command echo, but not the actual data packet. I suspect the device is still be busy with the initialization and needs a bit more time before it's ready to accept a request.
This commit is contained in:
parent
c4cbd19d5b
commit
edd777dbd3
@ -239,6 +239,10 @@ cressi_edy_device_open (dc_device_t **out, dc_context_t *context, const char *na
|
||||
return DC_STATUS_IO;
|
||||
}
|
||||
|
||||
// Make sure everything is in a sane state.
|
||||
serial_sleep(device->port, 300);
|
||||
serial_flush(device->port, SERIAL_QUEUE_BOTH);
|
||||
|
||||
// Send the init commands.
|
||||
cressi_edy_init1 (device);
|
||||
cressi_edy_init2 (device);
|
||||
@ -253,6 +257,10 @@ cressi_edy_device_open (dc_device_t **out, dc_context_t *context, const char *na
|
||||
return DC_STATUS_IO;
|
||||
}
|
||||
|
||||
// Make sure everything is in a sane state.
|
||||
serial_sleep(device->port, 300);
|
||||
serial_flush(device->port, SERIAL_QUEUE_BOTH);
|
||||
|
||||
*out = (dc_device_t*) device;
|
||||
|
||||
return DC_STATUS_SUCCESS;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user