mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Planner: Change where we clear deco and reset gradients
We should run clear_deco as early as we can. We should calculate the nuclear regeneration and start gradient after calculating tissue tolerance. We don't need to redo nuclear regeration and start gradient after that. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									2d45e587ba
								
							
						
					
					
						commit
						27ba48a09e
					
				
					 1 changed files with 8 additions and 10 deletions
				
			
		
							
								
								
									
										18
									
								
								planner.c
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								planner.c
									
										
									
									
									
								
							|  | @ -960,6 +960,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool | |||
| 	set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth); | ||||
| 	if (!diveplan->surface_pressure) | ||||
| 		diveplan->surface_pressure = SURFACE_PRESSURE; | ||||
| 	displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; | ||||
| 	clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); | ||||
| 	create_dive_from_plan(diveplan, is_planner); | ||||
| 
 | ||||
| 	// Do we want deco stop array in metres or feet?
 | ||||
|  | @ -1000,14 +1002,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool | |||
| 		create_dive_from_plan(diveplan, is_planner); | ||||
| 		return(false); | ||||
| 	} | ||||
| 	nuclear_regeneration(clock); | ||||
| 	clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); | ||||
| 	vpmb_start_gradient(); | ||||
| 	previous_deco_time = 100000000; | ||||
| 	deco_time = 10000000; | ||||
| 
 | ||||
| 	tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); | ||||
| 	displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; | ||||
| 
 | ||||
| #if DEBUG_PLAN & 4 | ||||
| 	printf("gas %s\n", gasname(&gas)); | ||||
|  | @ -1037,6 +1031,11 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool | |||
| 	bottom_time = clock = previous_point_time = displayed_dive.dc.sample[displayed_dive.dc.samples - 1].time.seconds; | ||||
| 	gi = gaschangenr - 1; | ||||
| 
 | ||||
| 	/* Set tissue tolerance and initial vpmb gradient at start of ascent phase */ | ||||
| 	tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); | ||||
| 	nuclear_regeneration(clock); | ||||
| 	vpmb_start_gradient(); | ||||
| 
 | ||||
| 	if(prefs.deco_mode == RECREATIONAL) { | ||||
| 		bool safety_stop = prefs.safetystop && max_depth >= 10000; | ||||
| 		track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop); | ||||
|  | @ -1101,8 +1100,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool | |||
| 	} | ||||
| 
 | ||||
| 	// VPM-B or Buehlmann Deco
 | ||||
| 	nuclear_regeneration(clock); | ||||
| 	vpmb_start_gradient(); | ||||
| 	tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); | ||||
| 	previous_deco_time = 100000000; | ||||
| 	deco_time = 10000000; | ||||
| 	cache_deco_state(tissue_tolerance, &bottom_cache);  // Lets us make several iterations
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue