summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-05-18 22:18:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-26 09:58:23 -0700
commit1093d6235b5657746f2cb4524ed08cf13c80c3bb (patch)
tree76e9a3ca520fd538ad69529d469c8ab5aab4788c /planner.c
parent04b6b6aaf9cc194a698c2302abc2032f730aecb4 (diff)
downloadsubsurface-1093d6235b5657746f2cb4524ed08cf13c80c3bb.tar.gz
Reenabled copying the diveplan to dive notes.
Gas consumption calculation fixed. Pressure difference still needs cylinder size to be set. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/planner.c b/planner.c
index 86e4fc3ca..b0715ff13 100644
--- a/planner.c
+++ b/planner.c
@@ -480,7 +480,6 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops,
return stoplevels;
}
-#if DO_WE_WANT_THIS_IN_QT
static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
{
char buffer[20000];
@@ -493,7 +492,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
return;
snprintf(buffer, sizeof(buffer), translate("gettextFromC", "%s\nSubsurface dive plan\nbased on GFlow = %.0f and GFhigh = %.0f\n\n"),
- disclaimer, plangflow * 100, plangfhigh * 100);
+ disclaimer, diveplan->gflow * 100, diveplan->gfhigh * 100);
/* we start with gas 0, then check if that was changed */
o2 = get_o2(&dive->cylinder[0].gasmix);
he = get_he(&dive->cylinder[0].gasmix);
@@ -566,6 +565,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
double volume;
const char *unit;
char gas[64];
+ if (dive->cylinder[gasidx].type.size.mliter)
+ dive->cylinder[gasidx].end.mbar = dive->cylinder[gasidx].start.mbar - consumption[gasidx] / dive->cylinder[gasidx].type.size.mliter / 1000;
if (consumption[gasidx] == 0)
continue;
len = strlen(buffer);
@@ -576,7 +577,6 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
}
dive->notes = strdup(buffer);
}
-#endif
int ascend_velocity(int depth, int avg_depth, int bottom_time)
{
@@ -768,9 +768,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
goto error_exit;
record_dive(dive);
-#if DO_WE_WANT_THIS_IN_QT
add_plan_to_notes(diveplan, dive);
-#endif
error_exit:
free(stoplevels);