On 13/10/2014 12:27, Robert Helling wrote:


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?

… I think this is much better and should solve all problems at once.

Best
Robert

Robert,

I have had a bit of time to look through the code and, to get things working in the shorter term, it looks like there are two options:

1) Use populate_plot_entries() in profile.c, which, while populating plot_data, will calculate the appropriate po2 value and store it in event->pressures.o2. All the appropriate pointers are in the calling parameters for this function. I would then keep the ccr-po2 calculations as a separate function being called by populate_plot_entries(). But this would split the partial pressure calculations over more than one function.

2) To call ccr-o2 calculations from fill_pressures, a pointer to plot_data would be required in order to get to the o2 sensor values, assuming they are not in the pressures structure any more. This would imply changing the calling parameters so that a pointer to plot_data is passed in order that the o2 calculations can be done with a construct such as pressures->o2 = calc_CCR_po2(struct plot_data *entry; struct divecomputer *dc); If this were to happen, the most direct route would possibly be to make the first calling parameter of fill_pressures() a pointer to plot_data. Then, inside that function, a pointer to "pressures" is created by
gas_pressures *pressures = &(entry->pressures);
or something similar. Then fill_pressures() can pass the pointer to plot_data on when it calls CCR-o2 calculations. This would keep all the partial pressure calculations together but would in effect necessitate a change in the calling parameters for fill_pressures.

Please give me comment?

I hope the above is understandable.
Kind regards,
wilem

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

Reply via email to