On 13.10.2014, at 08:49, Willem Ferguson <[email protected]> 
wrote:

Willem,

> I think we have different understandings of the logic.


I have just tried to fix the partial pressure calculation but stopped since I 
found it is missing more than I thought.

As it turns out your patch breaks the ceiling calculation not only for CCR 
dives but for all dives (at least also for my OC dives).

Let me point out a few things:

1) Your sensor data never reaches fill_pressures: You make the pressures struct 
(and I would like to add that using one structure to both pass data in and out 
of the function does not sound like such a great idea to me) be a member of the 
entry struct. But then, that gets never used as add_segments gets called which 
does not now about entry and thus creates a new pressures struct which has 
uninitialized values in it.

One simple way to fix this would be to do the sensor voting logic not in 
fill_pressures but in a separate function and then feed the resulting majority 
vote for the po2 into add_segment. For example you could call that from 
profile.c with the entry as argument (or just a pointer to the sensors array) 
to obtain the po2. Then you could leave the data of the individual sensors out 
to the pressures struct.

2) I can unbreak the OC part by at least

th-ws-tmpim01:subsurface helling$ git diff
diff --git a/dive.c b/dive.c
index 4d906e5..d624cce 100644
--- a/dive.c
+++ b/dive.c
@@ -1623,7 +1623,7 @@ extern void fill_pressures(struct gas_pressures 
*pressures, const double amb_pre
                        pressures->o2 = po2;
                pressures->he = (amb_pressure - pressures->o2) * 
(double)get_he(mix) / (1000 - get_o2(mix));
                pressures->n2 = amb_pressure - pressures->o2 - pressures->he;
-       } else if (!pressures->o2) { // Open circuit dives: no gas pressure 
values available, they need to be calculated
+       } else { // Open circuit dives: no gas pressure values available, they 
need to be calculated
                pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure;
                pressures->he = get_he(mix) / 1000.0 * amb_pressure;
                pressures->n2 = (1000 - get_o2(mix) - get_he(mix)) / 1000.0 * 
amb_pressure;

3) In the case of two sensors, why does your for loop iterate over three 
sensors?

Best
Robert

-- 
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics
                      Scientific Coordinator
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik
                      Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
                      http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F




Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to