summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-01-23 16:37:04 +0100
committerGravatar Subsurface <dirk@subsurface-divelog.org>2017-01-23 22:11:51 -0800
commit79bba04fd4e6472679e51c4210fd16a2f5292763 (patch)
tree4b29d58b92a32ae2a64c35538884996605839c1f
parent4cc4f5dd7bbb3a5d020850812f2a079eb62e4dfa (diff)
downloadsubsurface-79bba04fd4e6472679e51c4210fd16a2f5292763.tar.gz
Don't creat zero minute legs for gas switchen when replanning
Gas switches appear as special samples with zero or one second duration. Those can be confusing when they appear as zero duration in the dive plan when replanning, so better suppress theose. Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r--qt-models/diveplannermodel.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 6fe4ac003..d214ebaac 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -72,6 +72,7 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
recalc = false;
CylindersModel::instance()->updateDive();
duration_t lasttime = {};
+ duration_t lastrecordedtime = {};
duration_t newtime = {};
free_dps(&diveplan);
diveplan.when = d->when;
@@ -103,7 +104,10 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
}
if (samplecount) {
int cylinderid = get_cylinderid_at_time(d, dc, lasttime);
- addStop(depthsum / samplecount, newtime.seconds, cylinderid, 0, true);
+ if (newtime.seconds - lastrecordedtime.seconds > 10) {
+ addStop(depthsum / samplecount, newtime.seconds, cylinderid, 0, true);
+ lastrecordedtime = newtime;
+ }
lasttime = newtime;
depthsum = 0;
samplecount = 0;