summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2016-04-09 09:22:46 +1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-18 20:10:10 -0700
commited8e665242412509f41270ae0928598c5d7e3680 (patch)
treeaeef36e7cd658806067236fdb66efc568acc1a1e /profile.c
parent15d07a879e71ad8cefce6fe1972ed0ab6d27d52d (diff)
downloadsubsurface-ed8e665242412509f41270ae0928598c5d7e3680.tar.gz
VPM-B profile: declare CVA iteration variables within each loop
The variables that control each CVA iteration should be declared at the start of each loop so that the values are carried over from one iteration to the next. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/profile.c b/profile.c
index 8fbeed9c7..f1ebe0fed 100644
--- a/profile.c
+++ b/profile.c
@@ -934,10 +934,8 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
{
int i, count_iteration = 0;
double surface_pressure = (dc->surface_pressure.mbar ? dc->surface_pressure.mbar : get_surface_pressure_in_mbar(dive, true)) / 1000.0;
- int last_ndl_tts_calc_time = 0;
- int first_ceiling = 0, current_ceiling;
bool first_iteration = true;
- int final_tts = 0 , time_clear_ceiling = 0, time_deep_ceiling = 0, deco_time = 0, prev_deco_time = 10000000;
+ int deco_time = 0, prev_deco_time = 10000000;
char *cache_data_initial = NULL;
/* For VPM-B outside the planner, cache the initial deco state for CVA iterations */
if (prefs.deco_mode == VPMB && !in_planner())
@@ -945,6 +943,7 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
/* For VPM-B outside the planner, iterate until deco time converges (usually one or two iterations after the initial)
* Set maximum number of iterations to 10 just in case */
while ((abs(prev_deco_time - deco_time) >= 30) && (count_iteration < 10)) {
+ int last_ndl_tts_calc_time = 0, first_ceiling = 0, current_ceiling, final_tts = 0 , time_clear_ceiling = 0, time_deep_ceiling = 0;
for (i = 1; i < pi->nr; i++) {
struct plot_data *entry = pi->entry + i;
int j, t0 = (entry - 1)->sec, t1 = entry->sec;