mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Equipment: Fix 'used' Gas Selection for CCR Dives.
Fix how gases are marked as 'used' and kept from being deleted in the equipment tab for CCR dives. It does not make sense to treat the (arbitrary) first gas in the list with a usage type of 'diluent' or 'oxygen' as 'used' and prevent the user from deleting it. Dive computers report the initial diluent and any other diluents used through a 'gaschange' event, so the actually used diluents are already picked up as part of gaschange event based logic. Also clarify the selection of the first diluent used as a default if no gaschange events exist. Also fixed the test data - gases that have a pressure change should be included in the profile if they do not have a gas change recorded against them by other dive computers, even if they are oxygen. A secondary problem shown by this is that the pressure change is not applied to the profile - the pressure is currently shown as constant on the start pressure. But this is for another pull request. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
5fae7ce7a0
commit
8f0380fd05
5 changed files with 7030 additions and 7033 deletions
|
@ -1,5 +1,6 @@
|
|||
equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used'
|
||||
equipment: include unused cylinders in merged dive if the preference is enabled
|
||||
equipment: fix bug showing the first diluent in the gas list as 'used' for CCR dives
|
||||
desktop: added button to hide the infobox in the dive profile
|
||||
desktop: use persisted device information for the dive computer configuration
|
||||
core: fix bug using salinity and pressure values in mbar <-> depth conversion
|
||||
|
|
|
@ -616,7 +616,7 @@ int explicit_first_cylinder(const struct dive *dive, const struct divecomputer *
|
|||
if (ev && ((dc->sample && ev->time.seconds == dc->sample[0].time.seconds) || ev->time.seconds <= 1))
|
||||
res = get_cylinder_index(dive, ev);
|
||||
else if (dc->divemode == CCR)
|
||||
res = MAX(get_cylinder_idx_by_use(dive, DILUENT), 0);
|
||||
res = MAX(get_cylinder_idx_by_use(dive, DILUENT), res);
|
||||
}
|
||||
return res < dive->cylinders.nr ? res : 0;
|
||||
}
|
||||
|
|
|
@ -317,12 +317,6 @@ bool has_gaschange_event(const struct dive *dive, const struct divecomputer *dc,
|
|||
return true;
|
||||
event = get_next_event(event->next, "gaschange");
|
||||
}
|
||||
if (dc->divemode == CCR) {
|
||||
if (idx == get_cylinder_idx_by_use(dive, DILUENT))
|
||||
return true;
|
||||
if (idx == get_cylinder_idx_by_use(dive, OXYGEN))
|
||||
return true;
|
||||
}
|
||||
return !first_gas_explicit && idx == 0;
|
||||
}
|
||||
|
||||
|
@ -343,6 +337,8 @@ bool is_cylinder_used(const struct dive *dive, int idx)
|
|||
for_each_dc(dive, dc) {
|
||||
if (has_gaschange_event(dive, dc, idx))
|
||||
return true;
|
||||
else if (dc->divemode == CCR && idx == get_cylinder_idx_by_use(dive, OXYGEN))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue