From f8e8bd3b545c152ef53b8331e9e2198aeb214ac5 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 4 Nov 2010 20:50:28 +0100 Subject: [PATCH] Discard the additional bytes inside the init function. --- src/oceanic_atom2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 81b1604..793cc94 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -213,6 +213,9 @@ oceanic_atom2_init (oceanic_atom2_device_t *device) if (rc != DEVICE_STATUS_SUCCESS) return rc; + // Discard all additional bytes (if there are any) + serial_flush (device->port, SERIAL_QUEUE_INPUT); + return DEVICE_STATUS_SUCCESS; } @@ -289,9 +292,6 @@ oceanic_atom2_device_open (device_t **out, const char* name) return status; } - // Make sure everything is in a sane state. - serial_flush (device->port, SERIAL_QUEUE_BOTH); - // Switch the device from surface mode into download mode. Before sending // this command, the device needs to be in PC mode (automatically activated // by connecting the device), or already in download mode.