mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
b5c00c89e6
commit
23efcef58a
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue