From a4a5e8c7137c5156343ac93a6c1e82739c00995e Mon Sep 17 00:00:00 2001 From: Tim Segers Date: Sun, 9 Jul 2023 18:16:35 +0200 Subject: Output ascent segments until deco starts proper even without SHOW_TRAVEL --- src/schedule.c | 8 ++++++-- 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 #include +#include #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, -- cgit v1.2.3-70-g09d2