[PATCH] Fill up plot_data with temperature all the way
Anton Lundin
glance at acc.umu.se
Wed Nov 13 05:03:06 UTC 2013
On 13 November, 2013 - Dirk Hohndel wrote:
> On Tue, 2013-11-12 at 23:00 +0100, Anton Lundin wrote:
> > This will fill out the gaps of temperature data between all the points
> > so we always have a temperature to show in the info box.
> >
> > Signed-off-by: Anton Lundin <glance at acc.umu.se>
> > ---
> > profile.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/profile.c b/profile.c
> > index 1f90ffc..edeb17a 100644
> > --- a/profile.c
> > +++ b/profile.c
> > @@ -707,7 +707,7 @@ void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct gra
> > static struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
> > {
> > int idx, maxtime, nr, i;
> > - int lastdepth, lasttime;
> > + int lastdepth, lasttime, lasttemp = 0;
> > struct plot_data *plot_data;
> >
> > maxtime = pi->maxtime;
> > @@ -774,7 +774,10 @@ static struct plot_data *populate_plot_entries(struct dive *dive, struct divecom
> > /* FIXME! sensor index -> cylinder index translation! */
> > entry->cylinderindex = sample->sensor;
> > SENSOR_PRESSURE(entry) = sample->cylinderpressure.mbar;
> > - entry->temperature = sample->temperature.mkelvin;
> > + if (sample->temperature.mkelvin)
> > + entry->temperature = lasttemp = sample->temperature.mkelvin;
> > + else
> > + entry->temperature = lasttemp;
> >
> > lasttime = time;
> > lastdepth = depth;
>
> OK, now from an actual computer...
>
> My problem with this patch is that it does the wrong thing for
> situations where you have only a very small number of temperature
> readings (e.g.; ONE). I know that I have seen XML files that have a
> single reading about half way through the dive (at the deepest spot,
> IIRC). So for dive computers like this it does something rather odd -
> you get no temperature for most of the dive, and then you get a
> potentially wrong temperature for the rest of the dive.
>
This patch doesn't change what we store as dc data, its the same as
before. This just fills up with temperature data in the plot_data, aka
whats shown, and not whats stored.
Take a look at dives/test27.xml, it only has a temp sample in the
beginning and it gets drawn as a straight line for the whole dive. This
makes that temperature visible in the info box.
//Anton
--
Anton Lundin +46702-161604
More information about the subsurface
mailing list