Robert,
On 13/10/2014 11:25, Robert Helling wrote:
On 13.10.2014, at 08:49, Willem Ferguson
<[email protected]
<mailto:[email protected]>> wrote:
Willem,
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
If I execute calculate_deco_information() AFTER get_pressures(), then,
for OC as well as CCR dives, the ceilings appear correct because, now,
there are calculated po2 values to work from, allowing calculation of
pn2 values and ceilings. See line 962 in profile.c (latest master). But
I do not know whether you would consider the swop of order a wise thing
to do. But this does not solve the ceilings for dive plans. Please
comment, will you?
What I can do is this:
Create a function in profile.c that does the voting. It will reside in
profile.c, be plot_info aware, and return a double, being the calculated
po2 value. Now we can remove the sensor values from the pressures
structure and return the sensor data to the "base level" of plot_info.
This might also remove the need of a 5th calling parameter for
get_pressures(). Please comment, will you?
If it were possible, I want to solve this problem before I leave for
meetings in east Africa on Wednesday and be away for two weeks.
Thank you so much for your time committed to solve this.
Kind regards,
willem
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface