Mares Smart Apnea

Giorgio Marzano marzano.giorgio at gmail.com
Sat Sep 5 17:00:14 PDT 2015


Again on the Mares Smart Apnea topic.

I think I have found a problem on the current SW implementation and I need
some advice. Sorry for the long message.


I have dumped my DC logbook, and some cross checking between the code and
the expected results from the mares SW.

I think I have found some problem in the code.
In the function  "mares_iconhd_extract_dives" it seems to me that the code
points to the very end of the buffer, then it starts crawling back to the
beginning of the last immersion:

offset = layout->rb_profile_end - layout->rb_profile_begin;


unsigned int nbytes = 4 + headersize + nsamples * samplesize;
...
// Move to the start of the dive.
offset -= nbytes;

...but it seems that on the Smart Apnea there is not a constant samplesize:
one immersion is a variable length (nsamples) sequence of dives , each one
having one header (dive time, surface time, temperature, ...) and a stream
of "dive time" depth measurements.


If this is true, the current approach can't work, as long as it is no
longer possible to compute "nbytes".

Am I wrong?

Is there any reason to start from the end and not from the beginning (the
"end of profile ring buffer" eop) and then move forward? I am getting
familiar with the memory layout of the DC but still have many many doubts
about the library code and architecture.

Any help would be very appreciated. I can provide the annotated dump, but I
am not sure what the mailing list netiquette says about big attachments.

Thank you in advance

Giorgio


EXAMPLE:

*** start immersion 2015 08 31 10.08

18 25 : LEN (in bytes)
00 00 : ??
*** sample 1 ***
0c 00 : maxdepth(1.2) sample 1
13 00 : dive time (19 secs)
00 00 : surface time (0)
fc 00 ??
fc 00 ??
04 00 ??
17 00 ??
0b 00  depth //19 depth measurements: 1 per second
0c 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0c 00 depth
0c 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0b 00 depth
0c 00 depth
0b 00 depth
0b 00 depth
09 00 depth

**** sample 2 ***
11 00 maxdepth (1.2)
2d 00 divetime
3c 00 surftime
fc 00 ??
fc 00 ??
05 00 ??
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libdivecomputer.org/pipermail/devel/attachments/20150906/de5a07b0/attachment.html>


More information about the devel mailing list