diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-07 12:49:07 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-07 12:49:07 -0800 |
commit | d396f4afd8411ec8f17c7a9015f0c615e720a27d (patch) | |
tree | 40c5bdb8909feda8cc329e1d2bf817ca4f555253 /planner.c | |
parent | d3570508b102b238d5c2258e522b4bcea26e44a7 (diff) | |
download | subsurface-d396f4afd8411ec8f17c7a9015f0c615e720a27d.tar.gz |
Add simple debug function to planner
This allows you to dump the diveplan structure
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r-- | planner.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -14,6 +14,31 @@ int stoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 21000, 30000, 42000, 60000, 90000 }; +#if DEBUG_PLAN +void dump_plan(struct diveplan *diveplan) +{ + struct divedatapoint *dp; + struct tm tm; + + if (!diveplan) { + printf ("Diveplan NULL\n"); + return; + } + utc_mkdate(diveplan->when, &tm); + + printf("Diveplan @ %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); + dp = diveplan->dp; + while (dp) { + printf("\t%3u:%02u: %dmm gas: %d o2 %d h2\n", FRACTION(dp->time, 60), dp->depth, dp->o2, dp->he); + dp = dp->next; + } + +} +#endif + /* returns the tissue tolerance at the end of this (partial) dive */ double tissue_at_end(struct dive *dive, char **cached_datap) { @@ -508,6 +533,9 @@ void show_planned_dive(void) } dpp = &(*dpp)->next; } +#if DEBUG_PLAN & 1 + dump_plan(&tempplan); +#endif plan(&tempplan, &cache_data, &planned_dive); free_dps(tempplan.dp); } |