[PATCH] Remove o2/he from plot_data and fix gas plot text

Anton Lundin glance at acc.umu.se
Sun Sep 22 22:29:23 UTC 2013


On 22 September, 2013 - Dirk Hohndel wrote:

> 
> So this code has been there for a loooong time and has been tested quite
> heavily. I'm not saying your fix is wrong, but I'd love to see some
> sample data that goes along with your analysis.
> 
> Thanks
> 

Have a look at dives/test15.xml, without the patch the plot graph says
air/air/air but the deco and pressure is based on the right cylinders,
and after the patch it says air / 15/50 / EAN70.

populate_plot_entries is called before populate_pressure_information in
create_plot_info so if your dc doesn't contain sensor-info in samples,
and instead relies on gaschange-events, the o2 and he parts of plot_data
will always be wrong.
Then better to always rely on cylinderindex and lookup current gas based
on that.


Hope this explains and shows things.


//Anton


> On Sun, 2013-09-22 at 23:21 +0200, Anton Lundin wrote:
> > plot_data.o2 and plot_data.he was wrong for all dives, due to that
> > cylinderindex was set right first in populate_pressure_information, and
> > thus those two contained bogus information.
> > This makes the plot-text use cylinderindex-lookup as everything else.
> > 
> > Signed-off-by: Anton Lundin <glance at acc.umu.se>
> > ---
> >  profile.c                 | 8 --------
> >  profile.h                 | 1 -
> >  qt-ui/profilegraphics.cpp | 3 ++-
> >  3 files changed, 2 insertions(+), 10 deletions(-)
> > 
> > diff --git a/profile.c b/profile.c
> > index 693b246..a5c5d11 100644
> > --- a/profile.c
> > +++ b/profile.c
> > @@ -840,8 +840,6 @@ static struct plot_data *populate_plot_entries(struct dive *dive, struct divecom
> >  		entry->po2 = sample->po2 / 1000.0;
> >  		/* FIXME! sensor index -> cylinder index translation! */
> >  		entry->cylinderindex = sample->sensor;
> > -		entry->o2 = dive->cylinder[entry->cylinderindex].gasmix.o2.permille;
> > -		entry->he = dive->cylinder[entry->cylinderindex].gasmix.he.permille;
> >  		SENSOR_PRESSURE(entry) = sample->cylinderpressure.mbar;
> >  		entry->temperature = sample->temperature.mkelvin;
> >  
> > @@ -855,12 +853,6 @@ static struct plot_data *populate_plot_entries(struct dive *dive, struct divecom
> >  	plot_data[idx++].sec = lasttime+20;
> >  	pi->nr = idx;
> >  
> > -	/* make sure the first two entries have the correct gas */
> > -	plot_data[0].o2 = plot_data[2].o2;
> > -	plot_data[0].he = plot_data[2].he;
> > -	plot_data[1].o2 = plot_data[2].o2;
> > -	plot_data[1].he = plot_data[2].he;
> > -
> >  	return plot_data;
> >  }
> >  
> > diff --git a/profile.h b/profile.h
> > index 0c5fd7d..45e5a11 100644
> > --- a/profile.h
> > +++ b/profile.h
> > @@ -15,7 +15,6 @@ struct plot_info;
> >  struct plot_data {
> >  	unsigned int in_deco:1;
> >  	int cylinderindex;
> > -	int o2, he;
> >  	int sec;
> >  	/* pressure[0] is sensor pressure
> >  	 * pressure[1] is interpolated pressure */
> > diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
> > index b896384..5576bdd 100644
> > --- a/qt-ui/profilegraphics.cpp
> > +++ b/qt-ui/profilegraphics.cpp
> > @@ -519,7 +519,8 @@ void ProfileGraphicsView::plot_cylinder_pressure_text()
> >  			if (!seen_cyl[cyl]) {
> >  				plot_pressure_value(mbar, entry->sec, LEFT, BOTTOM);
> >  				plot_gas_value(mbar, entry->sec, LEFT, TOP,
> > -					       entry->o2, entry->he);
> > +						get_o2(&dive->cylinder[cyl].gasmix),
> > +						get_he(&dive->cylinder[cyl].gasmix));
> >  				seen_cyl[cyl] = TRUE;
> >  			}
> >  		}
> 

-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list