core: implement interpolate() function for unit types

Calls the global interpolate() function for integer types.

For now, the template is enabled if the arguments are not
integer types. Might want to refine that in the future.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-12-14 09:49:31 +01:00 committed by Michael Keller
parent 1ccfb823f0
commit 0e77dd9a68
4 changed files with 22 additions and 4 deletions

View file

@ -432,7 +432,7 @@ static void add_dive_to_deco(struct deco_state *ds, const struct dive &dive, boo
int j;
for (j = t0; j < t1; j++) {
depth_t depth = { .mm = interpolate(psample.depth.mm, sample.depth.mm, j - t0, t1 - t0) };
depth_t depth = interpolate(psample.depth, sample.depth, 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.at(j), dive.sac,