Purge the serial port buffer during initialization
This commit is contained in:
parent
8d35ee6978
commit
85074dba40
@ -420,6 +420,10 @@ mclean_extreme_device_open(dc_device_t **out, dc_context_t *context, dc_iostream
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Make sure everything is in a sane state.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
dc_iostream_purge (device->iostream, DC_DIRECTION_ALL);
|
||||
|
||||
*out = (dc_device_t *)device;
|
||||
|
||||
return DC_STATUS_SUCCESS;
|
||||
|
||||
@ -376,6 +376,10 @@ tecdiving_divecomputereu_device_open (dc_device_t **out, dc_context_t *context,
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Make sure everything is in a sane state.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
dc_iostream_purge (device->iostream, DC_DIRECTION_ALL);
|
||||
|
||||
// Send the init command.
|
||||
status = tecdiving_divecomputereu_send (device, CMD_INIT, NULL, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user