core: return pressures structure from fill_pressures()

Instead of taking an out-parameter. That's more idiomatic C++.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-05 06:54:30 +02:00 committed by bstoeger
parent ead58cd039
commit 411188728d
6 changed files with 22 additions and 24 deletions

View file

@ -637,13 +637,12 @@ void update_setpoint_events(const struct dive *dive, struct divecomputer *dc)
const struct event *next = get_next_event(ev, "gaschange");
for (int i = 0; i < dc->samples; i++) {
struct gas_pressures pressures;
if (next && dc->sample[i].time.seconds >= next->time.seconds) {
ev = next;
gasmix = get_gasmix_from_event(dive, ev);
next = get_next_event(ev, "gaschange");
}
fill_pressures(&pressures, lrint(calculate_depth_to_mbarf(dc->sample[i].depth.mm, dc->surface_pressure, 0)), gasmix ,0, dc->divemode);
gas_pressures pressures = fill_pressures(lrint(calculate_depth_to_mbarf(dc->sample[i].depth.mm, dc->surface_pressure, 0)), gasmix ,0, dc->divemode);
if (abs(dc->sample[i].setpoint.mbar - (int)(1000 * pressures.o2)) <= 50)
dc->sample[i].setpoint.mbar = 0;
}