From 79bba04fd4e6472679e51c4210fd16a2f5292763 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 23 Jan 2017 16:37:04 +0100 Subject: [PATCH] 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 --- qt-models/diveplannermodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;