Profile: Improve Display of Bailout / Loop Events.

For dives in CCR mode, show 'bailout' and 'on loop' events whenever a
gas switch from a diluent gas to a bailout gas and vice versa happens.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-09-22 23:24:25 +12:00
parent 55b72d40e3
commit 0ac70a0feb
16 changed files with 183 additions and 121 deletions

View file

@ -373,7 +373,7 @@ static void save_samples(struct membuffer *b, const struct dive &dive, const str
save_sample(b, s, dummy, o2sensor);
}
static void save_one_event(struct membuffer *b, const struct dive &dive, const struct event &ev)
static void save_one_event(struct membuffer *b, const struct dive &dive, const struct divecomputer &dc, const struct event &ev)
{
put_format(b, "event %d:%02d", FRACTION_TUPLE(ev.time.seconds, 60));
show_index(b, ev.type, "type=", "");
@ -385,7 +385,7 @@ static void save_one_event(struct membuffer *b, const struct dive &dive, const s
show_index(b, ev.value, "value=", "");
show_utf8(b, " name=", ev.name.c_str(), "");
if (ev.is_gaschange()) {
struct gasmix mix = dive.get_gasmix_from_event(ev);
struct gasmix mix = dive.get_gasmix_from_event(ev, dc).first;
if (ev.gas.index >= 0)
show_integer(b, ev.gas.index, "cylinder=", "");
put_gasmix(b, mix);
@ -396,7 +396,7 @@ static void save_one_event(struct membuffer *b, const struct dive &dive, const s
static void save_events(struct membuffer *b, const struct dive &dive, const struct divecomputer &dc)
{
for (auto &ev: dc.events)
save_one_event(b, dive, ev);
save_one_event(b, dive, dc, ev);
}
static void save_dc(struct membuffer *b, const struct dive &dive, const struct divecomputer &dc)