diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-07-09 22:13:36 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-09 13:22:00 -0700 |
commit | 848a5352c7afedd530186ae842719e8f67c8c66a (patch) | |
tree | 304260e9a579133fc96d08395ee05c224a2a2ae2 | |
parent | 72aeb53e191c1e717aa0216387149b925cb3d52f (diff) | |
download | subsurface-848a5352c7afedd530186ae842719e8f67c8c66a.tar.gz |
Add support divecomputer based TTS
Since earlier have we had support for our own calculated TTS. This adds
support for holding TTS values reported by a dive computer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | dive.h | 1 | ||||
-rw-r--r-- | load-git.c | 4 | ||||
-rw-r--r-- | parse-xml.c | 2 | ||||
-rw-r--r-- | profile.c | 2 | ||||
-rw-r--r-- | profile.h | 1 | ||||
-rw-r--r-- | save-git.c | 4 | ||||
-rw-r--r-- | save-xml.c | 4 |
7 files changed, 18 insertions, 0 deletions
@@ -147,6 +147,7 @@ struct sample // BASE TYPE BYTES UNITS RANGE DE duration_t time; // uint32_t 4 seconds (0-68 yrs) elapsed dive time up to this sample duration_t stoptime; // uint32_t 4 seconds (0-18 h) time duration of next deco stop duration_t ndl; // uint32_t 4 seconds (0-18 h) time duration before no-deco limit + duration_t tts; // uint32_t 4 seconds (0-18 h) time duration to reach the surface depth_t depth; // int32_t 4 mm (0-2000 km) dive depth of this sample depth_t stopdepth; // int32_t 4 mm (0-2000 km) depth of next deco stop temperature_t temperature; // int32_t 4 mdegrK (0-2 MdegK) ambient temperature diff --git a/load-git.c b/load-git.c index be0e3539c..e61a0ca13 100644 --- a/load-git.c +++ b/load-git.c @@ -357,6 +357,10 @@ static void parse_sample_keyvalue(void *_sample, const char *key, const char *va sample->ndl = get_duration(value); return; } + if (!strcmp(key, "tts")) { + sample->tts = get_duration(value); + return; + } if (!strcmp(key, "in_deco")) { sample->in_deco = atoi(value); return; diff --git a/parse-xml.c b/parse-xml.c index 01599d61a..5375e3202 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -850,6 +850,8 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu return; if (MATCH("ndl.sample", sampletime, &sample->ndl)) return; + if (MATCH("tts.sample", sampletime, &sample->tts)) + return; if (MATCH("in_deco.sample", get_index, &in_deco)) { sample->in_deco = (in_deco == 1); return; @@ -1316,6 +1316,8 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me } else if (has_ndl) { put_format(b, translate("gettextFromC", "NDL: %umin\n"), DIV_UP(entry->ndl, 60)); } + if (entry->tts) + put_format(b, translate("gettextFromC", "TTS: %umin\n"), DIV_UP(entry->tts, 60)); if (entry->stopdepth_calc && entry->stoptime_calc) { depthvalue = get_depth_units(entry->stopdepth_calc, NULL, &depth_unit); put_format(b, translate("gettextFromC", "Deco: %umin @ %.0f%s (calc)\n"), DIV_UP(entry->stoptime_calc, 60), @@ -29,6 +29,7 @@ struct plot_data { int ceiling; int ceilings[16]; int ndl; + int tts; int stoptime; int stopdepth; int cns; diff --git a/save-git.c b/save-git.c index f7a244a2a..0ba6e9801 100644 --- a/save-git.c +++ b/save-git.c @@ -243,6 +243,10 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl put_format(b, " ndl=%u:%02u", FRACTION(sample->ndl.seconds, 60)); old->ndl = sample->ndl; } + if (sample->tts.seconds != old->tts.seconds) { + put_format(b, " tts=%u:%02u", FRACTION(sample->tts.seconds, 60)); + old->tts = sample->tts; + } if (sample->in_deco != old->in_deco) { put_format(b, " in_deco=%d", sample->in_deco ? 1 : 0); old->in_deco = sample->in_deco; diff --git a/save-xml.c b/save-xml.c index 514600dd4..9c802b82a 100644 --- a/save-xml.c +++ b/save-xml.c @@ -219,6 +219,10 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl put_format(b, " ndl='%u:%02u min'", FRACTION(sample->ndl.seconds, 60)); old->ndl = sample->ndl; } + if (sample->tts.seconds != old->tts.seconds) { + put_format(b, " tts='%u:%02u min'", FRACTION(sample->tts.seconds, 60)); + old->tts = sample->tts; + } if (sample->in_deco != old->in_deco) { put_format(b, " in_deco='%d'", sample->in_deco ? 1 : 0); old->in_deco = sample->in_deco; |