Dive data import error with Hollis DG03
Hamish Moffatt
hamish at cloud.net.au
Wed Mar 26 22:57:39 PDT 2014
On 26/03/14 23:38, Jef Driesen wrote:
>
> @Hamish: Can you also confirm with the 1ms delay?
>
Looks good. Assuming I got all the right patches (I've posted the whole
patch I used below), I got a single error which increased the sleep
delay to 1ms and then another later which increased it to 2ms, but the
whole dump completed in 55s.
[0.000028] DATETIME 2014-03-27T05:42:56Z (1395898976)
[0.000050] VERSION 0.5.0-devel (fa90009c293a9ca1a4eaf49a478b381477695c0a)
[0.000070] Opening the device (Oceanic VT3, /dev/ttyUSB0).
[0.000077] INFO: Open: name=/dev/ttyUSB0
[0.000884] INFO: Configure: baudrate=38400, databits=8, parity=0,
stopbits=1, flowcontrol=0
[0.001007] INFO: Timeout: value=3000
[0.001013] INFO: Sleep: value=100
[0.101084] INFO: Flush: queue=3, input=0, output=0
[0.101416] INFO: Write: size=2, data=8400
[0.103190] INFO: Read: size=1, data=5A
[0.107197] INFO: Read: size=17, data=4F43452056543320523244203531324BBF
[0.107209] INFO: Sleep: value=50
[0.157269] Registering the event handler.
[0.157289] Registering the cancellation handler.
[0.157362] Downloading the dives.
[0.157365] Event: progress 0.00% (0/64992)
[0.157377] Event: vendor=4F43452056543320523244203531324B
[0.161287] INFO: Write: size=4, data=B1000000
[0.161304] INFO: Read: size=1, data=5A
[0.169908] INFO: Read: size=17, data=0416041120081001425800730000000075
[0.169923] Event: progress 0.02% (16/64992)
[0.169938] Event: model=16984 (0x00004258), firmware=0 (0x00000000),
serial=7300 (0x00001c84)
[0.173270] INFO: Write: size=4, data=B1000400
[0.173284] INFO: Read: size=1, data=A5
[0.173286] ERROR: Unexpected answer start byte(s). [in
oceanic_atom2.c:343 (oceanic_atom2_send)]
[0.173289] INFO: Sleep: value=100
[0.273376] INFO: Flush: queue=1, input=0, output=0
[0.273391] INFO: Sleep: value=1
[0.277271] INFO: Write: size=4, data=B1000400
[0.277283] INFO: Read: size=1, data=5A
[0.288194] INFO: Read: size=17, data=300220028003500530BEB0BB0000000085
[0.288206] Event: progress 0.05% (32/63424)
[0.288214] INFO: Sleep: value=1
[54.059572] Event: progress 98.29% (61728/62800)
[54.059577] INFO: Sleep: value=1
[54.061265] INFO: Write: size=4, data=B10C2500
[54.062543] INFO: Read: size=1, data=A5
[54.062549] ERROR: Unexpected answer start byte(s). [in
oceanic_atom2.c:343 (oceanic_atom2_send)]
[54.062553] INFO: Sleep: value=100
[54.162651] INFO: Flush: queue=1, input=0, output=0
[54.162668] INFO: Sleep: value=2
[54.165270] INFO: Write: size=4, data=B10C2500
[54.166170] INFO: Read: size=1, data=5A
[54.177275] INFO: Read: size=17, data=010A9C0057024B00010A9A0057024B0094
[54.177290] Event: progress 98.32% (61744/62800)
[54.177301] INFO: Sleep: value=2
[54.181273] INFO: Write: size=4, data=B10C2400
[54.181286] INFO: Read: size=1, data=5A
[54.192064] INFO: Read: size=17, data=010C9500570247000108970057024C0087
[54.192075] Event: progress 98.34% (61760/62800)
[54.192084] INFO: Sleep: value=2
[54.197269] INFO: Write: size=4, data=B10C2300
[54.197280] INFO: Read: size=1, data=5A
[55.162925] INFO: Read: size=17, data=6400000300001400880805A00251000205
[55.162946] Event: progress 100.00% (62800/62800)
[55.162958] Dive: number=59, size=1656, fingerprint=38881F032AE39BC4
[55.162982] Creating the parser.
[55.162987] Registering the data.
[55.162990] Parsing the datetime.
[55.162995] Parsing the divetime.
[55.163008] Parsing the maxdepth.
[55.163012] Parsing the gas mixes.
[55.163018] Parsing the salinity.
[55.163022] Parsing the atmospheric pressure.
[55.163025] Parsing the sample data.
[55.163514] Destroying the parser.
[55.179364] Closing the device.
[55.179399] INFO: Sleep: value=2
[55.185316] INFO: Write: size=4, data=6A05A500
[55.185338] INFO: Read: size=1, data=A5
[55.186422] Result: Success
I'm a bit confused as to if the new 50ms delay is needed, since we've
already successfully read the device's version at that point (and
there's a 100ms sleep and flush before that too). I think it's just
putting off the (seemingly inevitable) increase to 1ms sleep...
I tried removing it, ran it again, quickly got to sleep = 1 as above,
sleep = 2 after 34 seconds, sleep = 3 after 41 seconds. Another run just
got sleep = 1 then completed successfully with no further errors (55
seconds total).
Anyway here's the full patch I used against current git, just so we can
verify I tested the right thing:
Hamish
diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c
index 2746426..716af88 100644
--- a/src/oceanic_atom2.c
+++ b/src/oceanic_atom2.c
@@ -47,6 +47,7 @@
typedef struct oceanic_atom2_device_t {
oceanic_common_device_t base;
serial_t *port;
+ unsigned int delay;
} oceanic_atom2_device_t;
static dc_status_t oceanic_atom2_device_read (dc_device_t *abstract,
unsigned int address, unsigned char data[], unsigned int size);
@@ -318,6 +319,10 @@ oceanic_atom2_send (oceanic_atom2_device_t *device,
const unsigned char command[
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
+ if (device->delay) {
+ serial_sleep (device->port, device->delay);
+ }
+
// Send the command to the dive computer.
int n = serial_write (device->port, command, csize);
if (n != csize) {
@@ -364,6 +369,8 @@ oceanic_atom2_transfer (oceanic_atom2_device_t
*device, const unsigned char comm
if (nretries++ >= MAXRETRIES)
return rc;
+ device->delay += 1;
+
// Delay the next attempt.
serial_sleep (device->port, 100);
serial_flush (device->port, SERIAL_QUEUE_INPUT);
@@ -421,6 +428,7 @@ oceanic_atom2_device_open (dc_device_t **out,
dc_context_t *context, const char
// Set the default values.
device->port = NULL;
+ device->delay = 0;
// Open the device.
int rc = serial_open (&device->port, context, name);
@@ -498,6 +506,9 @@ oceanic_atom2_device_open (dc_device_t **out,
dc_context_t *context, const char
device->base.layout = &oceanic_default_layout;
}
+ // Delay to avoid initial failure
+ serial_sleep (device->port, 50);
+
*out = (dc_device_t*) device;
return DC_STATUS_SUCCESS;
More information about the subsurface
mailing list