Refactoring: Improve event_loop.

Improve the event loop architecture by making it set the divecomputer in
the constructor - using the same loop for multiple dive computers is not
intended to work.
Also change `next()` in `divemode_loop` to `at()` to make the name more
aligned with its function.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-09-03 19:48:49 +12:00 committed by bstoeger
parent 33bb39f1ca
commit ee25e8a1db
11 changed files with 28 additions and 33 deletions

View file

@ -433,7 +433,7 @@ static void add_dive_to_deco(struct deco_state *ds, const struct dive &dive, boo
int depth = interpolate(psample.depth.mm, sample.depth.mm, j - t0, t1 - t0);
auto gasmix = loop.at(j).first;
add_segment(ds, dive.depth_to_bar(depth), gasmix, 1, sample.setpoint.mbar,
loop_d.next(j), dive.sac,
loop_d.at(j), dive.sac,
in_planner);
}
}