diff options
author | Tim Segers <tsegers@pm.me> | 2023-07-09 18:16:35 +0200 |
---|---|---|
committer | Tim Segers <tsegers@pm.me> | 2023-07-09 18:16:35 +0200 |
commit | a4a5e8c7137c5156343ac93a6c1e82739c00995e (patch) | |
tree | 6e7061b42c4cd403d3d05133171365b94038e473 | |
parent | 163b67306b5903ab83ad1de9f9eed2c582177d35 (diff) | |
download | opendeco-a4a5e8c7137c5156343ac93a6c1e82739c00995e.tar.gz |
Output ascent segments until deco starts proper even without SHOW_TRAVEL
-rw-r--r-- | src/schedule.c | 8 | ||||
-rw-r--r-- | src/schedule.h | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/schedule.c b/src/schedule.c index 1827ff3..b2c50c1 100644 --- a/src/schedule.c +++ b/src/schedule.c @@ -2,6 +2,7 @@ #include <assert.h> #include <math.h> +#include <stdbool.h> #include "schedule.h" @@ -131,6 +132,8 @@ decoinfo_t calc_deco(decostate_t *ds, const gas_t *deco_gasses, int nof_gasses, double current_gf; const gas_t *best; + bool deco_started = false; + /* check if direct ascent is possible */ if (direct_ascent(ds, asc_per_min)) return (decoinfo_t){.tts = 0, .ndl = calc_ndl(ds, asc_per_min)}; @@ -152,7 +155,7 @@ decoinfo_t calc_deco(decostate_t *ds, const gas_t *deco_gasses, int nof_gasses, if (SWITCH_INTERMEDIATE && best && best != ds->gas) { /* emit waypoint because we're about to switch gas */ - emit_waypoint(ds, SEG_TRAVEL, wp_cb); + emit_waypoint(ds, deco_started ? SEG_TRAVEL : SEG_ASCENT, wp_cb); /* switch gas */ add_segment_const(ds, ds->depth, 1, best); @@ -194,7 +197,8 @@ decoinfo_t calc_deco(decostate_t *ds, const gas_t *deco_gasses, int nof_gasses, return (decoinfo_t){.ndl = 0, .tts = ds->runtime - runtime_start}; } - emit_waypoint(ds, SEG_TRAVEL, wp_cb); + emit_waypoint(ds, deco_started ? SEG_TRAVEL : SEG_ASCENT, wp_cb); + deco_started = true; /* switch to better gas if available */ best = best_gas(ds->depth, deco_gasses, nof_gasses); diff --git a/src/schedule.h b/src/schedule.h index 06c4713..7d7ac0f 100644 --- a/src/schedule.h +++ b/src/schedule.h @@ -20,6 +20,7 @@ typedef struct decoinfo_t { } decoinfo_t; typedef enum segtype_t { + SEG_ASCENT, SEG_DECO_STOP, SEG_DIVE, SEG_GAS_SWITCH, |