Git complains about a corrupt patch... /D
On Fri, Oct 31, 2014 at 09:27:59PM +0200, Willem Ferguson wrote: > > Remove code that zeroes out duplicate oxygen sensor and temperature values > > Remove the code that changes all duplicate oxygen sensor, setpoint and > temperature > values from a dive log to zero. One of the motivations is that a zero > setpoint > value indicates an Open Circuit dive segment, not Closed Circuit Rebreather. > The > code in dive.c is removed and the comments for the corresponding restoration > code that restores > the last known values into sensor or temperature with zero values is > [fill_o2_values() > in profile.c] is changed to apply to the present situation. > > Signed-off-by: willem ferguson <[email protected]> > > I did some experimenting with the code that restores zeroed oxygen values to > last-known values. > If I remove the restoration code, then the o2 profile for the Poseidon data > goes wonky: o2 values are > not reported with every sample, so the restoration code is still required. > Same applies to > temperature data. > Kind regards, > willem > > From 4801a22ec7493e41560300543d4bb20c9678847f Mon Sep 17 00:00:00 2001 > From: willem ferguson <[email protected]> > Date: Fri, 31 Oct 2014 21:00:17 +0200 > Subject: [PATCH 2/2] Remove code that zeroes out duplicate oxygen sensor and > temperature values > > Remove the code that changes all duplicate oxygen sensor, setpoint and > temperature > values from a dive log to zero. One of the motivations is that a zero setpoint > value indicates an Open Circuit dive segment, not Closed Circuit Rebreather. > The > code in dive.c is removed and the comments for the corresponding code that > reinserts > the last known values into sensor or temperature with zero values is > [fill_o2_values() > in profile.c] is changed to apply to the present situation. > > Signed-off-by: willem ferguson <[email protected]> > --- > dive.c | 51 ++++++++++++++++++++++++++------------------------- > profile.c | 27 +++++++++++---------------- > 2 files changed, 37 insertions(+), 41 deletions(-) > > diff --git a/dive.c b/dive.c > index 9f4df56..118ee2b 100644 > --- a/dive.c > +++ b/dive.c > @@ -1098,15 +1098,16 @@ static void fixup_dc_events(struct divecomputer *dc) > > static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) > { > - int i, j, o2val; > + int i, j; > double depthtime = 0; > int lasttime = 0; > int lastindex = -1; > int maxdepth = dc->maxdepth.mm; > int mintemp = 0; > int lastdepth = 0; > - int lasttemp = 0, lastpressure = 0, lastdiluentpressure = 0; > - int lasto2val[3] = { 0, 0, 0 }; > + int lastpressure = 0, lastdiluentpressure = 0; > int pressure_delta[MAX_CYLINDERS] = { INT_MAX, }; > int first_cylinder; > > @@ -1164,31 +1165,31 @@ static void fixup_dive_dc(struct dive *dive, struct > divecomputer *dc) > fixup_pressure(dive, sample); > > if (temp) { > - /* > - * If we have consecutive identical > - * temperature readings, throw away > - * the redundant ones. > - */ > - if (lasttemp == temp) > - sample->temperature.mkelvin = 0; > - else > - lasttemp = temp; > - > if (!mintemp || temp < mintemp) > mintemp = temp; > } > - > - // If there are consecutive identical O2 sensor readings, throw > away the redundant ones. > - for (j = 0; j < dc->no_o2sensors; j++) { // for CCR oxygen > sensor data: > - o2val = sample->o2sensor[j].mbar; > - if (o2val) { > - if (lasto2val[j] == o2val) > - sample->o2sensor[j].mbar = 0; > - else > - lasto2val[j] = o2val; > - } > - } > - > update_min_max_temperatures(dive, sample->temperature); > > depthtime += (time - lasttime) * (lastdepth + depth) / 2; > diff --git a/profile.c b/profile.c > index 4bc9422..bc59c48 100644 > --- a/profile.c > +++ b/profile.c > @@ -929,30 +929,26 @@ static void calculate_gas_information_new(struct dive > *dive, struct plot_info *p > > void fill_o2_values(struct divecomputer *dc, struct plot_info *pi, struct > dive *dive) > /* For CCR: > - * In the samples from each dive computer, any duplicate values for the > - * oxygen sensors were removed (i.e. set to 0) in order to conserve > - * storage space (see function fixup_dive_dc). But for drawing the profile > - * a complete series of valid o2 pressure values is required. This function > - * takes the oxygen sensor data and setpoint values from the structures > - * of plotinfo and re-inserts the duplicate values set to 0 so > - * that the oxygen sensor data are complete and ready for plotting. > - * The original sequence of oxygen values are recreated without attempting > - * any interpolations for values set to zero, recreating the raw data from > - * the CCR dive log. This function called by: create_plot_info_new() */ > + * In the samples from each dive computer, there may be uninitialised oxygen > + * sensor or setpoint values, e.g. when events were inserted into the dive > log > + * or if the dive computer does not report o2 values with every sample. But > + * for drawing the profile a complete series of valid o2 pressure values is > + * required. This function takes the oxygen sensor data and setpoint values > + * from the structures of plotinfo and replaces the zero values with their > + * last known values so that the oxygen sensor data are complete and ready > + * for plotting. This function called by: create_plot_info_new() */ > { > int i, j; > double last_setpoint, last_sensor[3], o2pressure, amb_pressure; > > for (i = 0; i < pi->nr; i++) { > struct plot_data *entry = pi->entry + i; > - // For 1st iteration, initialise the last_ values > if (dc->dctype == CCR) { > - if (i == 0) { > + if (i == 0) { // For 1st iteration, initialise the > last_ values: > last_setpoint = pi->entry->o2setpoint; > for (j = 0; j < dc->no_o2sensors; j++) > last_sensor[j] = pi->entry->o2sensor[j]; > - } else { > - // Now re-insert the missing oxygen pressure > values > + } else { // Now set the missing oxygen pressure > values: > if (entry->o2setpoint) > last_setpoint = entry->o2setpoint; > else > @@ -962,7 +958,7 @@ void fill_o2_values(struct divecomputer *dc, struct > plot_info *pi, struct dive * > last_sensor[j] = > entry->o2sensor[j]; > else > entry->o2sensor[j] = > last_sensor[j]; > - } // having initialised the empty > o2 sensor values for this point on the profile, > + } // Having initialised the empty o2 > sensor values for this point on the profile, > amb_pressure = depth_to_mbar(entry->depth, dive) / > 1000.0; > o2pressure = calculate_ccr_po2(entry,dc); // > ...calculate the po2 based on the sensor data > entry->pressures.o2 = MIN(o2pressure, amb_pressure); > @@ -1026,7 +1022,6 @@ void create_plot_info_new(struct dive *dive, struct > divecomputer *dc, struct plo > populate_pressure_information(dive, dc, pi, NONDILUENT); /* .. > calculate missing pressure entries for all gasses except diluent */ > if (dc->dctype == CCR) /* For CCR > dives.. */ > populate_pressure_information(dive, dc, pi, DILUENT); /* .. > calculate missing diluent gas pressure entries */ > - > fill_o2_values(dc, pi, dive); /* .. and > insert the O2 sensor data having 0 values. */ > calculate_sac(dive, pi); /* Calculate sac */ > calculate_deco_information(dive, dc, pi, false); /* and ceiling > information, using gradient factor values in Preferences) */ > -- > 1.9.1 > > _______________________________________________ > subsurface mailing list > [email protected] > http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
