Commit graph

6 commits

Author SHA1 Message Date
Michael Keller
8f0380fd05 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>
2023-07-25 12:05:51 +12:00
Rafael M. Salvioni
695c37499a Core: Fix bug salinity and pressure values in mbar <-> depth conversion
The conversion between mbar and depth sometimes uses DC's salinity, sometimes user's salinity. By other hand, it uses surface pressure given by user in calculation.
This fix try to standartize this values, using them from same source.

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-11 13:26:24 +12:00
Robert C. Helling
741099bdbb Show correct gas density in CCR mode
When collecting the data for the infobox, we have
already computed the current partial pressures of the
breathing gas taking into accoutn the divemode. Use
those rather than fractions (which for CCR mode are
those of diluent) to compute the gas density.

Reported-by: Pietro Tranquillini <p.tranquillini@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-11-08 10:43:47 -08:00
Robert C. Helling
9fd531dcc5 Round gas depth properly
The D in MOD, EAD, END, and EADD stands for "depth" and
as such these should be mm in int rather than double.

The intermediate fn2 and fhe2, however, as intermediate
value should not be rounded to an integer.

The upshot of this is a litle more numerical stability.
It should lead to more stable values in TestProfile
when run on architectures with different floating
point precision.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-12-06 22:29:04 +01:00
Robert C. Helling
41258647d2 Don't access gasmix.o2.fraction
Air is a special gas that does not contain oxygen according
to gasmix.o2.fraction. If you want to use the fo2, you
need to use get_o2() to treat this special case correctly.

This fixes a bug when setting the MND of a gas containing
21% oxygen when o2 is considered not narcotic.

Reported-by: Christoph Gruen <gruen.christoph@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-10-01 08:50:36 -07:00
Robert C. Helling
1c8c6f9551 Add test for profile in VPMB mode
For some reason, this test seems not to run effectively, at least
locally, I had to update the reference file.

Added a check that indeed the file to be compared was
successfully opened.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-03-24 10:30:22 -07:00