mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn M_OR_FT macro into a function
No point in this being a macro. Make it return a depth_t - it was unclear that this returns a depth in mm. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0e77dd9a68
commit
bd2f7e72f1
11 changed files with 105 additions and 97 deletions
|
|
@ -764,12 +764,12 @@ static void calculate_ndl_tts(struct deco_state *ds, const struct dive *dive, st
|
|||
const int ascent_s_per_deco_step = 1;
|
||||
/* how long time steps in deco calculations? */
|
||||
const int time_stepsize = 60;
|
||||
const int deco_stepsize = M_OR_FT(3, 10);
|
||||
const depth_t deco_stepsize = m_or_ft(3, 10);
|
||||
/* at what depth is the current deco-step? */
|
||||
depth_t ascent_depth { .mm = entry.depth };
|
||||
int next_stop = round_up(deco_allowed_depth(
|
||||
tissue_tolerance_calc(ds, dive, dive->depth_to_bar(ascent_depth), in_planner),
|
||||
surface_pressure, dive, 1).mm, deco_stepsize);
|
||||
surface_pressure, dive, 1).mm, deco_stepsize.mm);
|
||||
/* at what time should we give up and say that we got enuff NDL? */
|
||||
/* If iterating through a dive, entry.tts_calc needs to be reset */
|
||||
entry.tts_calc = 0;
|
||||
|
|
@ -802,14 +802,14 @@ static void calculate_ndl_tts(struct deco_state *ds, const struct dive *dive, st
|
|||
add_segment(ds, dive->depth_to_bar(ascent_depth),
|
||||
gasmix, ascent_s_per_step, entry.o2pressure.mbar, divemode, prefs.decosac, in_planner);
|
||||
next_stop = round_up(deco_allowed_depth(tissue_tolerance_calc(ds, dive, dive->depth_to_bar(ascent_depth), in_planner),
|
||||
surface_pressure, dive, 1).mm, deco_stepsize);
|
||||
surface_pressure, dive, 1).mm, deco_stepsize.mm);
|
||||
}
|
||||
ascent_depth.mm = next_stop;
|
||||
|
||||
/* And how long is the current deco-step? */
|
||||
entry.stoptime_calc = 0;
|
||||
entry.stopdepth_calc = next_stop;
|
||||
next_stop -= deco_stepsize;
|
||||
next_stop -= deco_stepsize.mm;
|
||||
|
||||
/* And how long is the total TTS */
|
||||
while (next_stop >= 0) {
|
||||
|
|
@ -829,7 +829,7 @@ static void calculate_ndl_tts(struct deco_state *ds, const struct dive *dive, st
|
|||
add_segment(ds, dive->depth_to_bar(ascent_depth),
|
||||
gasmix, ascent_s_per_deco_step, entry.o2pressure.mbar, divemode, prefs.decosac, in_planner);
|
||||
ascent_depth.mm = next_stop;
|
||||
next_stop -= deco_stepsize;
|
||||
next_stop -= deco_stepsize.mm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue