summaryrefslogtreecommitdiffstats
path: root/uemis.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-10 11:56:28 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-10 12:02:33 +0100
commite29a43681049ef30eb5129f140a1ed0936a9b516 (patch)
tree4c57c2582e72e42266b7b51ec92276d1b8250347 /uemis.c
parent7f515eb7e53c5ab6d8dde4d2e6876464ed7fdeae (diff)
parent6ad73a8f043be283c07df34c6a5a43fee1b444e8 (diff)
downloadsubsurface-e29a43681049ef30eb5129f140a1ed0936a9b516.tar.gz
Merge branch 'ceiling-plot'
This enables plotting the ceiling in deco dives and also adds the necessary code to the uemis importer. The only other dive computer this has been tested with the OSTC and that needs a libdivecomputer patch in order to provide the deco/ceiling information to Subsurface. Fixes #5
Diffstat (limited to 'uemis.c')
-rw-r--r--uemis.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/uemis.c b/uemis.c
index 25ff9bf49..72d20e360 100644
--- a/uemis.c
+++ b/uemis.c
@@ -18,6 +18,7 @@
#include "dive.h"
#include "uemis.h"
+#include <libdivecomputer/parser.h>
/*
* following code is based on code found in at base64.sourceforge.net/b64.c
@@ -119,7 +120,9 @@ bail:
return datalen;
}
-/* Create events from the flag bits;
+static gboolean in_deco;
+
+/* Create events from the flag bits and other data in the sample;
* These bits basically represent what is displayed on screen at sample time.
* Many of these 'warnings' are way hyper-active and seriously clutter the
* profile plot - so these are disabled by default
@@ -175,6 +178,21 @@ void uemis_event(struct dive *dive, struct sample *sample, uemis_sample_t *u_sam
add_event(dive, sample->time.seconds, 0, 0, 0, N_("Low Battery Alert"));
/* flags[7] reflects the little on screen icons that remind of previous
* warnings / alerts - not useful for events */
+
+ /* now add deco / ceiling events */
+ if (u_sample->p_amb_tol > dive->surface_pressure.mbar &&
+ u_sample->hold_time &&
+ u_sample->hold_time < 99) {
+ add_event(dive, sample->time.seconds, SAMPLE_EVENT_CEILING, SAMPLE_FLAGS_BEGIN,
+ u_sample->hold_depth * 10, N_("ceiling"));
+ add_event(dive, sample->time.seconds, SAMPLE_EVENT_DECOSTOP, 0,
+ u_sample->hold_time * 60, N_("deco"));
+ in_deco = TRUE;
+ } else if (in_deco) {
+ in_deco = FALSE;
+ add_event(dive, sample->time.seconds, SAMPLE_EVENT_CEILING, SAMPLE_FLAGS_END,
+ 0, N_("ceiling"));
+ }
}
/*
@@ -190,10 +208,11 @@ void uemis_parse_divelog_binary(char *base64, void *datap) {
struct dive *dive = *divep;
int template, gasoffset;
+ in_deco = FALSE;
datalen = uemis_convert_base64(base64, &data);
dive->airtemp.mkelvin = *(uint16_t *)(data + 45) * 100 + 273150;
-
+ dive->surface_pressure.mbar = *(uint16_t *)(data +43);
/* dive template in use:
0 = air
1 = nitrox (B)