mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Minor cleanups
Coding style in deco.c. Unneccessary if clause in profile.c (the loop starts with i = 1) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8eb92c576c
commit
77f4802ed6
2 changed files with 16 additions and 18 deletions
2
deco.c
2
deco.c
|
@ -129,7 +129,7 @@ double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds
|
|||
double ppn2 = (pressure - WV_PRESSURE) * (1000 - fo2 - gasmix->he.permille) / 1000.0;
|
||||
double pphe = (pressure - WV_PRESSURE) * gasmix->he.permille / 1000.0;
|
||||
|
||||
if(pressure > gf_low_pressure_this_dive)
|
||||
if (pressure > gf_low_pressure_this_dive)
|
||||
gf_low_pressure_this_dive = pressure;
|
||||
|
||||
if (ccpo2 > 0.0) { /* CC */
|
||||
|
|
32
profile.c
32
profile.c
|
@ -1832,7 +1832,8 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d
|
|||
double surface_pressure = (dive->surface_pressure.mbar ? dive->surface_pressure.mbar : 1013) / 1000.0;
|
||||
|
||||
for (i = 1; i < pi->nr; i++) {
|
||||
int fo2, fhe;
|
||||
int fo2, fhe, j, t0, t1;
|
||||
double tissue_tolerance;
|
||||
struct plot_data *entry = pi->entry + i;
|
||||
int cylinderindex = entry->cylinderindex;
|
||||
|
||||
|
@ -1862,23 +1863,20 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d
|
|||
pi->maxpp = entry->pn2;
|
||||
|
||||
/* and now let's try to do some deco calculations */
|
||||
if (i > 0) {
|
||||
int j;
|
||||
int t0 = (entry - 1)->sec;
|
||||
int t1 = entry->sec;
|
||||
double tissue_tolerance = 0;
|
||||
for (j = t0; j < t1; j++) {
|
||||
int depth = 0.5 + (entry - 1)->depth + (j - t0) * (entry->depth - (entry - 1)->depth) / (t1 - t0);
|
||||
double min_pressure = add_segment(depth_to_mbar(depth, dive) / 1000.0,
|
||||
&dive->cylinder[cylinderindex].gasmix, 1, entry->po2, dive);
|
||||
if (min_pressure > tissue_tolerance)
|
||||
tissue_tolerance = min_pressure;
|
||||
}
|
||||
if (t0 == t1)
|
||||
entry->ceiling = (entry - 1)->ceiling;
|
||||
else
|
||||
entry->ceiling = deco_allowed_depth(tissue_tolerance, surface_pressure, dive, !prefs.calc_ceiling_3m_incr);
|
||||
t0 = (entry - 1)->sec;
|
||||
t1 = entry->sec;
|
||||
tissue_tolerance = 0;
|
||||
for (j = t0; j < t1; j++) {
|
||||
int depth = 0.5 + (entry - 1)->depth + (j - t0) * (entry->depth - (entry - 1)->depth) / (t1 - t0);
|
||||
double min_pressure = add_segment(depth_to_mbar(depth, dive) / 1000.0,
|
||||
&dive->cylinder[cylinderindex].gasmix, 1, entry->po2, dive);
|
||||
if (min_pressure > tissue_tolerance)
|
||||
tissue_tolerance = min_pressure;
|
||||
}
|
||||
if (t0 == t1)
|
||||
entry->ceiling = (entry - 1)->ceiling;
|
||||
else
|
||||
entry->ceiling = deco_allowed_depth(tissue_tolerance, surface_pressure, dive, !prefs.calc_ceiling_3m_incr);
|
||||
}
|
||||
|
||||
#if DECO_CALC_DEBUG & 1
|
||||
|
|
Loading…
Reference in a new issue