On 14-01-15 19:43, Henrik Brautaset Aronsen wrote:
Jef Driesen wrote:
This is a (known) bug in libdivecomputer. Instead of a global progress
for the entire download, the petrel backend reports progress for each
individual dive. So the progress bar will go from 0 to 100% for every
dive. Due to the fact that the size of a dive isn't known in advance,
we have to assume the worst case value (0xFFFFFF). But in practice a
dive is usually much smaller, and thus the progress bar will stay near
zero.
An individual 0-100% progress for each dive is OK. The problem was that
the progress disappeared after a few dives had been imported. With
Dirk's debug line it becomes obvious why:
[...]
I have been looking into the estimation of the dive length based on the dive
time in the manifest. The results I get are off by 160 to 320 bytes (or 5-10
samples). I wonder if this is the same on other units or not. Can you give the
attached patch a try, and send back the logfile from the universal app? (Make
sure to run with the -vv option because I'm interested in the debug lines.)
Jef
diff --git a/src/shearwater_petrel.c b/src/shearwater_petrel.c
index 3534a26..6bfe6f3 100644
--- a/src/shearwater_petrel.c
+++ b/src/shearwater_petrel.c
@@ -254,6 +254,12 @@ shearwater_petrel_device_foreach (dc_device_t *abstract, dc_dive_callback_t call
while (offset < size) {
// Get the address of the dive.
unsigned int address = array_uint32_be (data + offset + 20);
+ unsigned int begin = array_uint32_be (data + offset + 4);
+ unsigned int end = array_uint32_be (data + offset + 8);
+ unsigned int divetime = array_uint32_be (data + offset + 12);
+ unsigned int guess = ((divetime + 9) / 10) * 0x20 + 3 * 0x80;
+ DEBUG (abstract->context, "divetime=%u, begin=%u, end=%u, delta=%u",
+ divetime, begin, end, end - begin);
// Download the dive.
rc = shearwater_common_download (&device->base, buffer, DIVE_ADDR + address, DIVE_SIZE, 1);
@@ -266,6 +272,8 @@ shearwater_petrel_device_foreach (dc_device_t *abstract, dc_dive_callback_t call
unsigned char *buf = dc_buffer_get_data (buffer);
unsigned int len = dc_buffer_get_size (buffer);
+ DEBUG (abstract->context, "actual=%u, divetime=%u, guess=%u, delta=%i",
+ len, divetime, guess, len - guess);
if (callback && !callback (buf, len, buf + 12, sizeof (device->fingerprint), userdata))
break;
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface