diff --git a/CHANGELOG.md b/CHANGELOG.md index c4d50a0f1..634342ab3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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]` diff --git a/core/divelist.c b/core/divelist.c index 4258d757a..09e3f372a 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -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); diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index c8112b2cd..0e34b3e81 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -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 diff --git a/dives/test40-42.xml b/dives/test40-42.xml index 070eb3ced..d4eca2c05 100644 --- a/dives/test40-42.xml +++ b/dives/test40-42.xml @@ -771,7 +771,7 @@ - + CCR dive @@ -3268,7 +3268,7 @@ - + CCR dive