diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2020-09-12 21:17:18 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-15 08:47:51 -0700 |
commit | 23efcef58a7c24124c690d2e075522a696a43baa (patch) | |
tree | 585418de10ab93131b9c9415b8246e4fa0b04ba3 /core/import-shearwater.c | |
parent | b5c00c89e6a7115c308c9f1a45fb0554100e272d (diff) | |
download | subsurface-23efcef58a7c24124c690d2e075522a696a43baa.tar.gz |
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 <miika.turkia@gmail.com>
Diffstat (limited to 'core/import-shearwater.c')
-rw-r--r-- | core/import-shearwater.c | 8 |
1 files 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; } |