summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-28 13:17:12 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-28 13:17:12 -0700
commit601ac0c3624b1cdb3c1bb44b213d72eba400e642 (patch)
tree89f4f733c1470547161ed425bdbe2a9c790d45aa
parentb63a5f0de6961dc483ec655c5046a3d833bf5227 (diff)
downloadsubsurface-601ac0c3624b1cdb3c1bb44b213d72eba400e642.tar.gz
Display air temperature in the info notebook page
So far we don't parse air temperature data via libdivecomputer. Nor are we set up to allow the user to manually enter it. We can parse it when downloading from a Uemis Zurich, though. This feature was suggested via trac.hohndel.org; this commit implements only part of what is requested there, so I simply reference the ticket here without closing it. References ticket #7 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--statistics.c8
-rw-r--r--uemis.c2
2 files changed, 10 insertions, 0 deletions
diff --git a/statistics.c b/statistics.c
index 0f58b61bd..c0b4a1eba 100644
--- a/statistics.c
+++ b/statistics.c
@@ -28,6 +28,7 @@ typedef struct {
*max_depth,
*avg_depth,
*water_temp,
+ *air_temp,
*sac,
*otu,
*o2he,
@@ -548,6 +549,11 @@ static void show_single_dive_stats(struct dive *dive)
set_label(single_w.water_temp, "%.1f %s", value, unit);
} else
set_label(single_w.water_temp, "");
+ if (dive->airtemp.mkelvin) {
+ value = get_temp_units(dive->airtemp.mkelvin, &unit);
+ set_label(single_w.air_temp, "%.1f %s", value, unit);
+ } else
+ set_label(single_w.air_temp, "");
value = get_volume_units(dive->sac, &decimals, &unit);
if (value > 0) {
set_label(single_w.sac, _("%.*f %s/min"), decimals, value, unit);
@@ -728,6 +734,7 @@ GtkWidget *single_stats_widget(void)
single_w.max_depth = new_info_label_in_frame(hbox, _("Max Depth"));
single_w.avg_depth = new_info_label_in_frame(hbox, _("Avg Depth"));
single_w.water_temp = new_info_label_in_frame(hbox, _("Water Temp"));
+ single_w.air_temp = new_info_label_in_frame(hbox, _("Air Temp"));
/* third row */
hbox = gtk_hbox_new(FALSE, 3);
@@ -749,6 +756,7 @@ void clear_stats_widgets(void)
set_label(single_w.max_depth, "");
set_label(single_w.avg_depth, "");
set_label(single_w.water_temp, "");
+ set_label(single_w.air_temp, "");
set_label(single_w.sac, "");
set_label(single_w.sac, "");
set_label(single_w.otu, "");
diff --git a/uemis.c b/uemis.c
index 237fd6c16..25ff9bf49 100644
--- a/uemis.c
+++ b/uemis.c
@@ -192,6 +192,8 @@ void uemis_parse_divelog_binary(char *base64, void *datap) {
datalen = uemis_convert_base64(base64, &data);
+ dive->airtemp.mkelvin = *(uint16_t *)(data + 45) * 100 + 273150;
+
/* dive template in use:
0 = air
1 = nitrox (B)