From 24621ed5196c1b74206a41929c12be21c5ec7964 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 3 Jun 2017 10:07:14 +0200 Subject: [PATCH] Improve the handling of unreadable dives Dives that are reported by the dive computer as unreadable (for example due to a power loss during the dive) are now skipped instead of being reported as a fatal error. Those dives can't be retrieved, so there is no good reason to abort the download. --- src/divesystem_idive.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/divesystem_idive.c b/src/divesystem_idive.c index f0c31dc..d26e2b4 100644 --- a/src/divesystem_idive.c +++ b/src/divesystem_idive.c @@ -471,8 +471,14 @@ divesystem_idive_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb (number ) & 0xFF, (number >> 8) & 0xFF}; rc = divesystem_idive_transfer (device, cmd_header, sizeof(cmd_header), packet, commands->header.size, &errcode); - if (rc != DC_STATUS_SUCCESS) - return rc; + if (rc != DC_STATUS_SUCCESS) { + if (errcode == ERR_UNREADABLE) { + WARNING(abstract->context, "Skipped unreadable dive!"); + continue; + } else { + return rc; + } + } if (memcmp(packet + 7, device->fingerprint, sizeof(device->fingerprint)) == 0) break;