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>
This commit is contained in:
Anton Lundin 2014-07-09 22:13:36 +02:00 committed by Dirk Hohndel
parent 72aeb53e19
commit 848a5352c7
7 changed files with 18 additions and 0 deletions

1
dive.h
View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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),

View file

@ -29,6 +29,7 @@ struct plot_data {
int ceiling;
int ceilings[16];
int ndl;
int tts;
int stoptime;
int stopdepth;
int cns;

View file

@ -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;

View file

@ -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;