mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Tidy up code in planner.c - create_dive_from_plan()
Tidy up the code which creates the first sample for time = 0 to make clear that the info for this does NOT come from the first planner point (dp). No functional change. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
f812dc5d9b
commit
180e51a906
1 changed files with 6 additions and 4 deletions
|
@ -261,7 +261,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
|
||||||
int oldpo2 = 0;
|
int oldpo2 = 0;
|
||||||
int lasttime = 0;
|
int lasttime = 0;
|
||||||
depth_t lastdepth = {.mm = 0};
|
depth_t lastdepth = {.mm = 0};
|
||||||
int lastcylid = 0;
|
int lastcylid;
|
||||||
enum dive_comp_type type = dive->dc.divemode;
|
enum dive_comp_type type = dive->dc.divemode;
|
||||||
|
|
||||||
if (!diveplan || !diveplan->dp)
|
if (!diveplan || !diveplan->dp)
|
||||||
|
@ -287,15 +287,17 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
|
||||||
free(ev);
|
free(ev);
|
||||||
}
|
}
|
||||||
dp = diveplan->dp;
|
dp = diveplan->dp;
|
||||||
cyl = &dive->cylinder[lastcylid];
|
/* Create first sample at time = 0, not based on dp because
|
||||||
|
* there is no real dp for time = 0, set first cylinder to 0
|
||||||
|
* O2 setpoint for this sample will be filled later from next dp */
|
||||||
|
cyl = &dive->cylinder[0];
|
||||||
sample = prepare_sample(dc);
|
sample = prepare_sample(dc);
|
||||||
sample->setpoint.mbar = dp->setpoint;
|
|
||||||
sample->sac.mliter = prefs.bottomsac;
|
sample->sac.mliter = prefs.bottomsac;
|
||||||
oldpo2 = dp->setpoint;
|
|
||||||
if (track_gas && cyl->type.workingpressure.mbar)
|
if (track_gas && cyl->type.workingpressure.mbar)
|
||||||
sample->pressure[0].mbar = cyl->end.mbar;
|
sample->pressure[0].mbar = cyl->end.mbar;
|
||||||
sample->manually_entered = true;
|
sample->manually_entered = true;
|
||||||
finish_sample(dc);
|
finish_sample(dc);
|
||||||
|
lastcylid = 0;
|
||||||
while (dp) {
|
while (dp) {
|
||||||
int po2 = dp->setpoint;
|
int po2 = dp->setpoint;
|
||||||
if (dp->setpoint)
|
if (dp->setpoint)
|
||||||
|
|
Loading…
Add table
Reference in a new issue