summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-08 14:05:25 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-08 14:05:25 -0800
commite903fa966ec00118c17af72e6563cac82c4e555c (patch)
tree316d917f573fa1a31b6757f1d26398014250d7c7 /planner.c
parent2ffeff9a2c6fd130bc9925ae37c2debf2eedb29f (diff)
downloadsubsurface-e903fa966ec00118c17af72e6563cac82c4e555c.tar.gz
Set a default surface pressure for dive plan and allow simplistic print
This commit makes sure we have a reasonable default surface pressure (we need an input field for that). It also adjusts the debug level settings so that compiling this with make CLCFLAGS=-DDEBUG_PLAN=3 will print out an almost usable dive plan. This is of course still lacking air consumption calculations and will show deco stops that we just transit through (if the ceiling lifts far enough during the transition to an intended stop that this stop can be skipped; this sometimes happens for the first stop (haven't seen it for a later one). But it's better than nothing, I guess. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/planner.c b/planner.c
index 04d37363d..9d304af2b 100644
--- a/planner.c
+++ b/planner.c
@@ -30,7 +30,7 @@ void dump_plan(struct diveplan *diveplan)
}
utc_mkdate(diveplan->when, &tm);
- printf("Diveplan @ %04d-%02d-%02d %02d:%02d:%02d (surfpres %dmbar):\n",
+ printf("\nDiveplan @ %04d-%02d-%02d %02d:%02d:%02d (surfpres %dmbar):\n",
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec,
diveplan->surface_pressure);
@@ -301,12 +301,12 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep)
o2 = dive->cylinder[0].gasmix.o2.permille;
he = dive->cylinder[0].gasmix.he.permille;
get_gas_from_events(&dive->dc, sample->time.seconds, &o2, &he);
-#if DEBUG_PLAN & 2
+#if DEBUG_PLAN & 4
printf("gas %d/%d\n", o2, he);
#endif
tissue_tolerance = tissue_at_end(dive, cached_datap);
ceiling = deco_allowed_depth(tissue_tolerance, diveplan->surface_pressure / 1000.0, dive, 1);
-#if DEBUG_PLAN & 2
+#if DEBUG_PLAN & 4
printf("ceiling %5.2lfm\n", ceiling / 1000.0);
#endif
for (stopidx = 0; stopidx < sizeof(stoplevels) / sizeof(int); stopidx++)
@@ -773,6 +773,7 @@ void input_plan()
gtk_widget_add_events(deltat, GDK_FOCUS_CHANGE_MASK);
g_signal_connect(deltat, "focus-out-event", G_CALLBACK(starttime_focus_out_cb), NULL);
diveplan.when = time(NULL) + 3600;
+ diveplan.surface_pressure = 1013;
nr_waypoints = 4;
add_waypoint_widgets(vbox, 0);
add_waypoint_widgets(vbox, 1);