mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
46365b3199
commit
741099bdbb
6 changed files with 31162 additions and 31166 deletions
|
|
@ -1160,6 +1160,11 @@ static int calculate_ccr_po2(struct plot_data *entry, const struct divecomputer
|
|||
}
|
||||
}
|
||||
|
||||
static double gas_density(const struct gas_pressures *pressures)
|
||||
{
|
||||
return (pressures->o2 * O2_DENSITY + pressures->he * HE_DENSITY + pressures->n2 * N2_DENSITY) / 1000.0;
|
||||
}
|
||||
|
||||
static void calculate_gas_information_new(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -1196,7 +1201,7 @@ static void calculate_gas_information_new(const struct dive *dive, const struct
|
|||
entry->pressures.n2 / amb_pressure * N2_DENSITY +
|
||||
entry->pressures.he / amb_pressure * HE_DENSITY) /
|
||||
(O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000), dive);
|
||||
entry->density = gas_density(gasmix, depth_to_mbar(entry->depth, dive));
|
||||
entry->density = gas_density(&entry->pressures);
|
||||
if (entry->mod < 0)
|
||||
entry->mod = 0;
|
||||
if (entry->ead < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue