From 23efcef58a7c24124c690d2e075522a696a43baa Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 12 Sep 2020 21:17:18 +0300 Subject: Fix a bug on Shearwater cloud gas changes Gas change is done to the cylinder we just found and not the last cylinder. Also switching the variable name to index as we are actually using that value outside the loop. Signed-off-by: Miika Turkia --- core/import-shearwater.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/import-shearwater.c b/core/import-shearwater.c index 84d9a1b06..7047f04d6 100644 --- a/core/import-shearwater.c +++ b/core/import-shearwater.c @@ -58,10 +58,10 @@ static int shearwater_changes(void *param, int columns, char **data, char **colu o2 = 1000; // Find the cylinder index - int i; + int index; bool found = false; - for (i = 0; i < state->cur_dive->cylinders.nr; ++i) { - const cylinder_t *cyl = get_cylinder(state->cur_dive, i); + for (index = 0; index < state->cur_dive->cylinders.nr; ++index) { + const cylinder_t *cyl = get_cylinder(state->cur_dive, index); if (cyl->gasmix.o2.permille == o2 && cyl->gasmix.he.permille == he) { found = true; break; @@ -75,7 +75,7 @@ static int shearwater_changes(void *param, int columns, char **data, char **colu cylinder_end(state); } - add_gas_switch_event(state->cur_dive, get_dc(state), state->sample_rate ? atoi(data[0]) / state->sample_rate * 10 : atoi(data[0]), state->cur_dive->cylinders.nr - 1); + add_gas_switch_event(state->cur_dive, get_dc(state), state->sample_rate ? atoi(data[0]) / state->sample_rate * 10 : atoi(data[0]), index); return 0; } -- cgit v1.2.3-70-g09d2