]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Minor corrections to printing of the last temperature
authorDirk Hohndel <dirk@hohndel.org>
Fri, 16 Sep 2011 16:51:38 +0000 (09:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 16 Sep 2011 16:51:38 +0000 (09:51 -0700)
 - the time stamp where we printed the last temp was wrong
 - we really shouldn't check mK for being identical - especially on dive
   computers that store a lot of samples

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
profile.c

index 72a1589d917dd64551a497b04f517db713ce8673..a56b7641fc2fefd3e41e33e8c4c3ac35e5fc5ed8 100644 (file)
--- a/profile.c
+++ b/profile.c
@@ -343,14 +343,13 @@ static void plot_single_temp_text(struct graphics_context *gc, int sec, int mkel
 static void plot_temperature_text(struct graphics_context *gc, struct plot_info *pi)
 {
        int i;
-       int last = 0;
+       int last = 0, sec = 0;
        int last_temperature = 0, last_printed_temp = 0;
 
        if (!setup_temperature_limits(gc, pi))
                return;
 
        for (i = 0; i < pi->nr; i++) {
-               int sec;
                struct plot_data *entry = pi->entry+i;
                int mkelvin = entry->temperature;
 
@@ -365,8 +364,8 @@ static void plot_temperature_text(struct graphics_context *gc, struct plot_info
                last_printed_temp = mkelvin;
        }
        /* it would be nice to print the end temperature, if it's different */
-       if (last_temperature != last_printed_temp)
-               plot_single_temp_text(gc, last, last_temperature);
+       if (abs(last_temperature - last_printed_temp) > 500)
+               plot_single_temp_text(gc, sec, last_temperature);
 }
 
 static void plot_temperature_profile(struct graphics_context *gc, struct plot_info *pi)