<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 13.10.2014, at 08:49, Willem Ferguson <<a href="mailto:willemferguson@zoology.up.ac.za">willemferguson@zoology.up.ac.za</a>> wrote:</div><div><br></div><div>Willem,</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">I think we have different understandings of the logic.</span></blockquote></div><div><br></div>I have just tried to fix the partial pressure calculation but stopped since I found it is missing more than I thought.<div><br></div><div>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).</div><div><br></div><div>Let me point out a few things:</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>2) I can unbreak the OC part by at least</div><div><br></div><div><div style="margin: 0px; font-size: 11px;">th-ws-tmpim01:subsurface helling$ git diff</div><div style="margin: 0px; font-size: 11px;"><b>diff --git a/dive.c b/dive.c</b></div><div style="margin: 0px; font-size: 11px;"><b>index 4d906e5..d624cce 100644</b></div><div style="margin: 0px; font-size: 11px;"><b>--- a/dive.c</b></div><div style="margin: 0px; font-size: 11px;"><b>+++ b/dive.c</b></div><div style="margin: 0px; font-size: 11px;"><span style="color: #34bbc7">@@ -1623,7 +1623,7 @@</span> extern void fill_pressures(struct gas_pressures *pressures, const double amb_pre</div><div style="margin: 0px; font-size: 11px;">                        pressures->o2 = po2;</div><div style="margin: 0px; font-size: 11px;">                pressures->he = (amb_pressure - pressures->o2) * (double)get_he(mix) / (1000 - get_o2(mix));</div><div style="margin: 0px; font-size: 11px;">                pressures->n2 = amb_pressure - pressures->o2 - pressures->he;</div><div style="margin: 0px; font-size: 11px; color: rgb(195, 55, 32);">-       } else if (!pressures->o2) { // Open circuit dives: no gas pressure values available, they need to be calculated</div><div style="margin: 0px; font-size: 11px; color: rgb(52, 189, 38);">+<span style="color: #000000">       </span>} else { // Open circuit dives: no gas pressure values available, they need to be calculated</div><div style="margin: 0px; font-size: 11px;">                pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure;</div><div style="margin: 0px; font-size: 11px;">                pressures->he = get_he(mix) / 1000.0 * amb_pressure;</div><div style="margin: 0px; font-size: 11px;">                pressures->n2 = (1000 - get_o2(mix) - get_he(mix)) / 1000.0 * amb_pressure;</div><div><br></div><div>3) In the case of two sensors, why does your for loop iterate over three sensors?</div><div><br class="webkit-block-placeholder"></div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Best</div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Robert</div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br>-- <br>.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO<br>Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics<br>                      Scientific Coordinator<br>                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik<br>                      Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339<br>                      <a href="http://www.atdotde.de">http://www.atdotde.de</a></div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br></div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Enhance your privacy, use cryptography! My PGP keys have fingerprints</div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and</div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F</div><div style="color: rgb(0, 0, 0); font-family: Menlo;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br></div></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></body></html>