Don't attempt to compute SAC for CCR dives

CCRs are different. It does not make sense to compute
a depth dependent SAC. You could compute the rate of O2
consumption but even that is likely wrong (as O2 in the
diluent would enter that as well), so simply don't attempt
it.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2021-11-14 03:55:33 +01:00 committed by Dirk Hohndel
parent cfd6a1634f
commit 07745893e5
4 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,4 @@
Divelist: Don't attempt to compute SAC for CCR dives
---
* Always add new entries at the very top of this file above other existing entries and this note.
* Use this layout for new entries: `[Area]: [Details about the change] [reference thread / issue]`

View file

@ -348,6 +348,10 @@ static double calculate_airuse(const struct dive *dive)
int airuse = 0;
int i;
// SAC for a CCR dive does not make sense.
if (dive->dc.divemode == CCR)
return 0.0;
for (i = 0; i < dive->cylinders.nr; i++) {
pressure_t start, end;
const cylinder_t *cyl = get_cylinder(dive, i);

View file

@ -143,7 +143,7 @@ void TabDiveInformation::updateProfile()
ui->diveTimeText->setText(get_dive_duration_string(current_dive->duration.seconds, tr("h"), tr("min"), tr("sec"),
" ", current_dive->dc.divemode == FREEDIVE));
ui->sacText->setText(current_dive->cylinders.nr > 0 && mean[0] ? SACs : QString());
ui->sacText->setText(current_dive->cylinders.nr > 0 && mean[0] && current_dive->dc.divemode != CCR ? SACs : QString());
if (current_dive->surface_pressure.mbar == 0) {
ui->atmPressVal->clear(); // If no atm pressure for dive then clear text box

View file

@ -771,7 +771,7 @@
<sample time='114:40 min' depth='0.0 m' />
</divecomputer>
</dive>
<dive number='1' sac='1.049 l/min' otu='97' cns='34%' date='2014-04-01' time='10:00:00' duration='77:54 min'>
<dive number='1' otu='97' cns='34%' date='2014-04-01' time='10:00:00' duration='77:54 min'>
<notes>CCR dive</notes>
<cylinder size='2.0 l' workpressure='232.0 bar' description='Oxy2' o2='100.0%' start='190.0 bar' end='130.0 bar' use='oxygen' />
<cylinder size='2.0 l' workpressure='232.0 bar' description='Dil2' start='185.0 bar' end='130.0 bar' use='diluent' />
@ -3268,7 +3268,7 @@
<sample time='82:50 min' depth='0.235 m' ndl='0:00 min' stoptime='0:00 min' cns='0%' po2='0.0 bar' />
</divecomputer>
</dive>
<dive number='1' sac='1.049 l/min' otu='97' cns='34%' date='2014-04-02' time='10:00:00' duration='77:54 min'>
<dive number='1' otu='97' cns='34%' date='2014-04-02' time='10:00:00' duration='77:54 min'>
<notes>CCR dive</notes>
<cylinder size='2.0 l' workpressure='232.0 bar' description='Oxy2' o2='100.0%' start='190.0 bar' end='130.0 bar' use='oxygen' />
<cylinder size='2.0 l' workpressure='232.0 bar' description='Dil2' start='185.0 bar' end='130.0 bar' use='diluent' />