diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-01-01 17:00:46 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-10 17:27:24 -0800 |
commit | a478eb5711db6a1950cf810ca0b67414b6910030 (patch) | |
tree | ff4683168b7ad5d1465a65a89a4f3c746d85ddae /dive.c | |
parent | 93eb386ba998b3351a9dff81fa8a4d6ad0715e25 (diff) | |
download | subsurface-a478eb5711db6a1950cf810ca0b67414b6910030.tar.gz |
Maintab combobox to set dive type
still needs some work
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -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; |