From b1906dd04f0162619df5710cde9248aa4b342a2b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 4 Mar 2020 19:29:59 +0100 Subject: cleanup: move add_gas_switch_event to dive.c Since all the other event-functions are also defined there. Ultimately, we should probably move them to their own event.c translation unit. Signed-off-by: Berthold Stoeger --- core/parse-xml.c | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'core/parse-xml.c') diff --git a/core/parse-xml.c b/core/parse-xml.c index 6218fc74d..2f3d7a283 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -697,31 +697,6 @@ static void try_to_match_autogroup(const char *name, char *buf) nonmatch("autogroup", name, buf); } -void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx) -{ - /* sanity check so we don't crash */ - if (idx < 0 || idx >= dive->cylinders.nr) { - report_error("Unknown cylinder index: %d", idx); - return; - } - /* The gas switch event format is insane for historical reasons */ - struct gasmix mix = get_cylinder(dive, idx)->gasmix; - int o2 = get_o2(mix); - int he = get_he(mix); - struct event *ev; - int value; - - o2 = (o2 + 5) / 10; - he = (he + 5) / 10; - value = o2 + (he << 16); - - ev = add_event(dc, seconds, he ? SAMPLE_EVENT_GASCHANGE2 : SAMPLE_EVENT_GASCHANGE, 0, value, "gaschange"); - if (ev) { - ev->gas.index = idx; - ev->gas.mix = mix; - } -} - static void get_cylinderindex(char *buffer, uint8_t *i, struct parser_state *state) { *i = atoi(buffer); -- cgit v1.2.3-70-g09d2