aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.c2
-rw-r--r--dive.h1
-rw-r--r--planner.c5
-rw-r--r--qt-ui/profile/profilewidget2.cpp2
4 files changed, 7 insertions, 3 deletions
diff --git a/dive.c b/dive.c
index dd847c261..472f8c2dc 100644
--- a/dive.c
+++ b/dive.c
@@ -542,7 +542,7 @@ static void update_temperature(temperature_t *temperature, int new)
*
* This ignores any surface time in the middle of the dive.
*/
-static void fixup_dc_duration(struct divecomputer *dc)
+void fixup_dc_duration(struct divecomputer *dc)
{
int duration, i;
int lasttime, lastdepth, depthtime;
diff --git a/dive.h b/dive.h
index a03dfe141..a1abab657 100644
--- a/dive.h
+++ b/dive.h
@@ -614,6 +614,7 @@ extern bool has_hr_data(struct divecomputer *dc);
extern void sort_table(struct dive_table *table);
extern struct dive *fixup_dive(struct dive *dive);
+extern void fixup_dc_duration(struct divecomputer *dc);
extern int dive_getUniqID(struct dive *d);
extern unsigned int dc_airtemp(struct divecomputer *dc);
extern unsigned int dc_watertemp(struct divecomputer *dc);
diff --git a/planner.c b/planner.c
index 51754de06..5d4570b28 100644
--- a/planner.c
+++ b/planner.c
@@ -924,10 +924,13 @@ void plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
}
}
- /* We made it to the surface */
+ /* We made it to the surface
+ * Create the final dive, add the plan to the notes and fixup some internal
+ * data that we need to be there when plotting the dive */
plan_add_segment(diveplan, clock - previous_point_time, 0, gas, po2, false);
create_dive_from_plan(diveplan, is_planner);
add_plan_to_notes(diveplan, &displayed_dive, show_disclaimer);
+ fixup_dc_duration(&displayed_dive.dc);
free(stoplevels);
free(gaschanges);
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 8f0d1584f..7941ffa31 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -481,7 +481,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
rulerItem->setPlotInfo(pInfo);
meanDepth->setVisible(prefs.show_average_depth);
meanDepth->setMeanDepth(pInfo.meandepth);
- meanDepth->setLine(0, 0, timeAxis->posAtValue(displayed_dive.duration.seconds), 0);
+ meanDepth->setLine(0, 0, timeAxis->posAtValue(currentdc->duration.seconds), 0);
Animations::moveTo(meanDepth,3, profileYAxis->posAtValue(pInfo.meandepth));
dataModel->emitDataChanged();