Purge the serial port buffer during initialization

This commit is contained in:
Jef Driesen 2020-06-01 19:15:49 +02:00
parent 8d35ee6978
commit 85074dba40
2 changed files with 8 additions and 0 deletions

View File

@ -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;

View File

@ -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) {