From a478eb5711db6a1950cf810ca0b67414b6910030 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 1 Jan 2015 17:00:46 +0100 Subject: Maintab combobox to set dive type still needs some work Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- dive.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'dive.c') diff --git a/dive.c b/dive.c index 17b67a590..680ceeb58 100644 --- a/dive.c +++ b/dive.c @@ -29,7 +29,7 @@ static const char *default_tags[] = { const char *cylinderuse_text[] = { QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen") }; -const char *dctype_text[] = { "OC", "CCR", "PSCR" }; +const char *dctype_text[] = { "OC", "CCR", "PSCR", "Freedive" }; int event_is_gaschange(struct event *ev) { @@ -872,6 +872,26 @@ int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc) return 0; } +void update_setpoint_events(struct divecomputer *dc) +{ + struct event *ev = get_next_event(dc->events, "SP change"); + bool changed = false; + int new_setpoint = 0; + + if (dc->dctype == CCR) + new_setpoint = prefs.defaultsetpoint; + + while (ev) { + if (ev->time.seconds == 0) { + ev->value = new_setpoint; + changed = true; + } + ev = get_next_event(ev->next, "SP change"); + } + if (!changed) + add_event(dc, 0, SAMPLE_EVENT_PO2, 0, new_setpoint, "SP change"); +} + void sanitize_gasmix(struct gasmix *mix) { unsigned int o2, he; -- cgit v1.2.3-70-g09d2