Mercurial > public > ostc4
comparison Discovery/Src/buehlmann.c @ 253:1663b3b204d7 bm-3
Buehlmann: cleanup, whitespace, static
Nothing functional here. Only cleanup, making things static where possible,
and corrected some horrible code alignments.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Fri, 12 Apr 2019 10:43:52 +0200 |
parents | 822416168585 |
children | a17f7fb3b2b5 |
comparison
equal
deleted
inserted
replaced
251:90cbeee0e1d4 | 253:1663b3b204d7 |
---|---|
7 /* Konvention: | 7 /* Konvention: |
8 float extExample_variable_can_be_used_with_extern; | 8 float extExample_variable_can_be_used_with_extern; |
9 */ | 9 */ |
10 | 10 |
11 #include <string.h> | 11 #include <string.h> |
12 //#include "arm_math.h" | |
13 #include <math.h> | 12 #include <math.h> |
14 #include <stdbool.h> | 13 #include <stdbool.h> |
15 #include "buehlmann.h" | 14 #include "buehlmann.h" |
16 #include "decom.h" | 15 #include "decom.h" |
17 | 16 |
19 extern const float buehlmann_N2_a[]; | 18 extern const float buehlmann_N2_a[]; |
20 extern const float buehlmann_N2_b[]; | 19 extern const float buehlmann_N2_b[]; |
21 extern const float buehlmann_He_a[]; | 20 extern const float buehlmann_He_a[]; |
22 extern const float buehlmann_He_b[]; | 21 extern const float buehlmann_He_b[]; |
23 | 22 |
24 | |
25 /* | |
26 typedef struct | |
27 { | |
28 float *pointer_array_tissue_nitrogen_bar; | |
29 float *pointer_array_tissue_helium_bar; | |
30 char gf_value; | |
31 | |
32 float output_ceiling_ambient_bar_or_input; | |
33 _Bool output_ceiling_tolerated_if_ceiling_used_as_input; | |
34 } tissue_test_tolerance_struct; | |
35 */ | |
36 typedef struct | 23 typedef struct |
37 { | 24 { |
38 float depth; | 25 float depth; |
39 int id; | 26 int id; |
40 } SStop; | 27 } SStop; |
45 | 32 |
46 # define PRESSURE_TEN_METER 1.0f | 33 # define PRESSURE_TEN_METER 1.0f |
47 # define PRESSURE_THREE_METER 0.333334f | 34 # define PRESSURE_THREE_METER 0.333334f |
48 # define PRESSURE_150_CM 0.15f | 35 # define PRESSURE_150_CM 0.15f |
49 # define PRESSURE_HALF_METER 0.05f | 36 # define PRESSURE_HALF_METER 0.05f |
50 /* | 37 |
51 # define PRESSURE_150_CM_MBAR 150 | 38 static void buehlmann_backup_and_restore(_Bool backup_restore_otherwise); |
52 # define PRESSURE_TWO_M_MBAR 200 | 39 static float tissue_tolerance(void); |
53 # define PRESSURE_FIVE_M_MBAR 500 | 40 static void ambient_bar_to_deco_stop_depth_bar(float ceiling); |
54 # define PRESSURE_TEN_M_MBAR 1000 | 41 static int ascend_with_all_gaschanges(float pressure_decrease); |
55 # define PRESSURE_120_METER 12.0 | 42 static float next_stop_depth_input_is_actual_stop_id(int actual_id); |
56 */ | 43 static float get_gf_at_pressure(float pressure); |
57 /* | 44 static void buehlmann_calc_ndl(void); |
58 _____________________________________________________________ | 45 static _Bool dive1_check_deco(void); |
59 */ | 46 |
60 | 47 static SDecoinfo gDecotable; |
61 | 48 static float gSurface_pressure_bar; |
62 void buehlmann_backup_and_restore(_Bool backup_restore_otherwise); | 49 static float gPressure; |
63 float tissue_tolerance(void); | 50 static int gGas_id; |
64 void ambient_bar_to_deco_stop_depth_bar(float ceiling); | 51 static float gTTS; |
65 int ascend_with_all_gaschanges(float pressure_decrease); | 52 static float gTissue_nitrogen_bar[16]; |
66 float next_stop_depth_input_is_actual_stop_id(int actual_id); | 53 static float gTissue_helium_bar[16]; |
67 float get_gf_at_pressure(float pressure); | 54 static float gGF_value; |
68 void buehlmann_calc_ndl(void); | 55 static float gCNS; |
69 _Bool dive1_check_deco(void); | 56 static int gNDL; |
70 | 57 |
71 /* | |
72 _____________________________________________________________ | |
73 */ | |
74 | |
75 SDecoinfo gDecotable; | |
76 float gSurface_pressure_bar; | |
77 float gPressure; | |
78 int gGas_id; | |
79 float gTTS; | |
80 float gTissue_nitrogen_bar[16]; | |
81 float gTissue_helium_bar[16]; | |
82 float gGF_value; | |
83 float gCNS; | |
84 //float gMax_ceiling_bar = 0; | |
85 int gNDL; | |
86 | |
87 | |
88 //SLifeData *pLifeData; | |
89 SDiveSettings *pBuDiveSettings; | 58 SDiveSettings *pBuDiveSettings; |
90 SDecoinfo* pDecolistBuehlmann; | 59 SDecoinfo* pDecolistBuehlmann; |
91 //signed char gGaschange_decreasing_depth_gas_id[BUEHLMANN_STRUCT_MAX_GASES]; | |
92 float gGF_low_depth_bar; | 60 float gGF_low_depth_bar; |
93 SStop gStop; | 61 SStop gStop; |
94 | 62 |
95 void buehlmann_init(void) | 63 void buehlmann_init(void) |
96 { | 64 { |
97 //gMax_ceiling_bar = 0; | 65 |
98 } | 66 } |
99 | 67 |
100 void buehlmann_backup_and_restore(_Bool backup_restore_otherwise) | 68 static void buehlmann_backup_and_restore(_Bool backup_restore_otherwise) |
101 { | 69 { |
102 static float pressure; | 70 static float pressure; |
103 static float gas_id; | 71 static float gas_id; |
104 static float tts; | 72 static float tts; |
105 static float tissue_nitrogen_bar[16]; | 73 static float tissue_nitrogen_bar[16]; |
130 memcpy(gTissue_nitrogen_bar, tissue_nitrogen_bar, (4*16)); | 98 memcpy(gTissue_nitrogen_bar, tissue_nitrogen_bar, (4*16)); |
131 memcpy(gTissue_helium_bar, tissue_helium_bar, (4*16)); | 99 memcpy(gTissue_helium_bar, tissue_helium_bar, (4*16)); |
132 } | 100 } |
133 | 101 |
134 } | 102 } |
135 /*void buehlmann__test__saturate_tissues(SBuehlmann *pInput, int seconds) | |
136 { | |
137 pBuehlmann = pInput; | |
138 pInput->dive_time_seconds += seconds; | |
139 // internal copying | |
140 gSurface_pressure_bar = pBuehlmann->pressure_surface_bar; | |
141 | |
142 gPressure = pBuehlmann->pressure_ambient_bar; | |
143 gGas_id = pBuehlmann->actual_gas_id; | |
144 memcpy(gTissue_nitrogen_bar, pBuehlmann->tissue_nitrogen_bar, (4*16)); | |
145 memcpy(gTissue_helium_bar, pBuehlmann->tissue_helium_bar, (4*16)); | |
146 | |
147 tissues_exposure_at_gPressure_seconds(seconds); | |
148 | |
149 memcpy(pBuehlmann->tissue_nitrogen_bar, gTissue_nitrogen_bar, (4*16)); | |
150 memcpy(pBuehlmann->tissue_helium_bar, gTissue_helium_bar, (4*16)); | |
151 }*/ | |
152 | 103 |
153 float buehlmann_get_gCNS(void) | 104 float buehlmann_get_gCNS(void) |
154 { | 105 { |
155 return gCNS; | 106 return gCNS; |
156 } | 107 } |
161 int ascend_time; | 112 int ascend_time; |
162 int tts_seconds; | 113 int tts_seconds; |
163 float pressure_delta; | 114 float pressure_delta; |
164 float next_depth; | 115 float next_depth; |
165 _Bool deco_reached = false; | 116 _Bool deco_reached = false; |
166 // tissue_test_tolerance_struct tolerance_data; | |
167 unsigned short *stoplist; | 117 unsigned short *stoplist; |
168 int i; | 118 int i; |
169 | |
170 // decom_CreateGasChangeList(pDiveSettings, pLifeData); | |
171 | 119 |
172 gCNS = 0; | 120 gCNS = 0; |
173 pDecoInfo->output_time_to_surface_seconds = 0; | 121 pDecoInfo->output_time_to_surface_seconds = 0; |
174 pDecoInfo->output_ndl_seconds = 0; | 122 pDecoInfo->output_ndl_seconds = 0; |
175 for(int i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++) | 123 for(int i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++) |
176 { | 124 { |
177 pDecoInfo->output_stop_length_seconds[i] = 0; | 125 pDecoInfo->output_stop_length_seconds[i] = 0; |
178 } | 126 } |
179 /* make input available global*/ | 127 /* make input available global*/ |
180 pBuDiveSettings = pDiveSettings; | 128 pBuDiveSettings = pDiveSettings; |
181 | 129 |
182 pDecolistBuehlmann = pDecoInfo; | 130 pDecolistBuehlmann = pDecoInfo; |
183 /* internal copying */ | 131 /* internal copying */ |
184 gSurface_pressure_bar = pLifeData->pressure_surface_bar; | 132 gSurface_pressure_bar = pLifeData->pressure_surface_bar; |
185 | 133 |
186 gPressure = pLifeData->pressure_ambient_bar; | 134 gPressure = pLifeData->pressure_ambient_bar; |
187 gGas_id = 0; | 135 gGas_id = 0; |
191 | 139 |
192 // | 140 // |
193 memcpy(&gDecotable, pDecolistBuehlmann, sizeof(SDecoinfo)); | 141 memcpy(&gDecotable, pDecolistBuehlmann, sizeof(SDecoinfo)); |
194 stoplist = gDecotable.output_stop_length_seconds; | 142 stoplist = gDecotable.output_stop_length_seconds; |
195 | 143 |
196 | 144 if(pLifeData->dive_time_seconds < 60) |
197 if(pLifeData->dive_time_seconds < 60) | 145 return; |
198 return; | |
199 /* coupling */ | |
200 | |
201 /* functions */ | |
202 | 146 |
203 // clean stop list | 147 // clean stop list |
204 for(i = 0; i < DECOINFO_STRUCT_MAX_STOPS; i++) | 148 for(i = 0; i < DECOINFO_STRUCT_MAX_STOPS; i++) |
205 stoplist[i] = 0; | 149 stoplist[i] = 0; |
206 gTTS = 0; | 150 gTTS = 0; |
207 gNDL = 0; | 151 gNDL = 0; |
208 | 152 |
209 if(pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero >= (gPressure - PRESSURE_150_CM)) | 153 if(pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero >= (gPressure - PRESSURE_150_CM)) |
210 { | 154 { |
211 deco_reached = true; | 155 deco_reached = true; |
212 } | 156 } |
213 | 157 |
214 | |
215 //ascend_with_all_gaschanges(gPressure - gSurface_pressure_bar); | |
216 gGF_value = ((float)pBuDiveSettings->gf_high) / 100.0f; | 158 gGF_value = ((float)pBuDiveSettings->gf_high) / 100.0f; |
217 //iling = tissue_tolerance(); | |
218 // includes backup for gGF_value | |
219 // NDL | |
220 buehlmann_backup_and_restore(true); // includes backup for gGF_value | 159 buehlmann_backup_and_restore(true); // includes backup for gGF_value |
221 if(!dive1_check_deco() ) | 160 if(!dive1_check_deco() ) |
222 { | 161 { |
223 buehlmann_backup_and_restore(false); | 162 buehlmann_backup_and_restore(false); |
224 // no deco | 163 // no deco |
231 return; | 170 return; |
232 } | 171 } |
233 buehlmann_backup_and_restore(false); | 172 buehlmann_backup_and_restore(false); |
234 pDecolistBuehlmann->output_ndl_seconds = 0; | 173 pDecolistBuehlmann->output_ndl_seconds = 0; |
235 | 174 |
236 gGF_value = get_gf_at_pressure(gPressure); | 175 gGF_value = get_gf_at_pressure(gPressure); |
237 //current ceiling at actual position | 176 //current ceiling at actual position |
238 ceiling = tissue_tolerance(); | 177 ceiling = tissue_tolerance(); |
239 //if(ceiling < pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero) | 178 ambient_bar_to_deco_stop_depth_bar(ceiling); |
240 //ambient_bar_to_deco_stop_depth_bar(pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero); | |
241 //else | |
242 ambient_bar_to_deco_stop_depth_bar(ceiling); | |
243 | 179 |
244 // set the base for all upcoming parameters | 180 // set the base for all upcoming parameters |
245 ceiling = gStop.depth + gSurface_pressure_bar; | 181 ceiling = gStop.depth + gSurface_pressure_bar; |
246 tts_seconds = 0; | 182 tts_seconds = 0; |
247 | 183 |
288 else | 224 else |
289 { | 225 { |
290 // initial values, upper code might not be executed (is within 150 cm) | 226 // initial values, upper code might not be executed (is within 150 cm) |
291 } | 227 } |
292 | 228 |
293 | 229 if (ceiling > gSurface_pressure_bar) |
294 | 230 { |
295 | 231 ceiling = gStop.depth + gSurface_pressure_bar; |
296 if(ceiling > gSurface_pressure_bar) | 232 // ascend the last meters to first stop (especially consider any gas changes around) |
297 { | 233 pressure_delta = gPressure - ceiling; |
298 | 234 ascend_time = (int) ceil(pressure_delta * 50.0f); |
299 ceiling = gStop.depth + gSurface_pressure_bar; | 235 tts_seconds += ascend_with_all_gaschanges(pressure_delta); |
300 // ascend the last meters to first stop (especially consider any gas changes around) | 236 } |
301 pressure_delta = gPressure - ceiling; | |
302 ascend_time = (int)ceil(pressure_delta * 50.0f); | |
303 tts_seconds += ascend_with_all_gaschanges(pressure_delta); | |
304 } | |
305 // NDL check | 237 // NDL check |
306 if(ceiling <= gSurface_pressure_bar) | 238 if(ceiling <= gSurface_pressure_bar) |
307 { | 239 { |
308 /* pInput == pBuehlmann same pointer*/ | 240 /* pInput == pBuehlmann same pointer*/ |
309 // NDL with GF_low | 241 // NDL with GF_low |
310 pDecolistBuehlmann->output_time_to_surface_seconds = 0; | 242 pDecolistBuehlmann->output_time_to_surface_seconds = 0; |
311 return; | 243 return; |
312 } | 244 } |
313 if(ceiling >pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero) | 245 if (ceiling > pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero) |
314 pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero = ceiling; | 246 pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero = ceiling; |
315 | 247 |
316 // calc gf loop | 248 // calc gf loop |
317 if(deco_reached) | 249 if(deco_reached) |
318 gGF_low_depth_bar = pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero - gSurface_pressure_bar; | 250 gGF_low_depth_bar = pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero - gSurface_pressure_bar; |
319 else | 251 else |
322 while(gStop.depth > 0) | 254 while(gStop.depth > 0) |
323 { | 255 { |
324 do | 256 do |
325 { | 257 { |
326 next_depth = next_stop_depth_input_is_actual_stop_id(gStop.id); | 258 next_depth = next_stop_depth_input_is_actual_stop_id(gStop.id); |
327 gGF_value = get_gf_at_pressure(next_depth + gSurface_pressure_bar); | 259 gGF_value = get_gf_at_pressure(next_depth + gSurface_pressure_bar); |
328 buehlmann_backup_and_restore(true); | 260 buehlmann_backup_and_restore(true); |
329 ascend_time = ascend_with_all_gaschanges(gStop.depth - next_depth); | 261 ascend_time = ascend_with_all_gaschanges(gStop.depth - next_depth); |
330 ceiling = tissue_tolerance(); | 262 ceiling = tissue_tolerance(); |
331 /* pre check actual limit */ | 263 /* pre check actual limit */ |
332 if(gDecotable.output_stop_length_seconds[gStop.id] >= 999*60) | 264 if(gDecotable.output_stop_length_seconds[gStop.id] >= 999*60) |
344 decom_oxygen_calculate_cns_exposure(10, &pBuDiveSettings->decogaslist[gGas_id], gPressure, &gCNS); | 276 decom_oxygen_calculate_cns_exposure(10, &pBuDiveSettings->decogaslist[gGas_id], gPressure, &gCNS); |
345 gDecotable.output_stop_length_seconds[gStop.id] += 10; | 277 gDecotable.output_stop_length_seconds[gStop.id] += 10; |
346 tts_seconds += 10; | 278 tts_seconds += 10; |
347 } | 279 } |
348 } while(next_depth == -1); | 280 } while(next_depth == -1); |
349 tts_seconds += ascend_time; | 281 tts_seconds += ascend_time; |
350 gStop.depth = next_depth; | 282 gStop.depth = next_depth; |
351 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) | 283 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) |
352 { | 284 { |
353 if(pBuDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) | 285 if(pBuDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) |
354 break; | 286 break; |
363 } | 295 } |
364 } | 296 } |
365 gStop.id--; | 297 gStop.id--; |
366 } | 298 } |
367 | 299 |
368 gDecotable.output_time_to_surface_seconds = tts_seconds; | 300 gDecotable.output_time_to_surface_seconds = tts_seconds; |
369 memcpy(pDecolistBuehlmann, &gDecotable, sizeof(SDecoinfo)); | 301 memcpy(pDecolistBuehlmann, &gDecotable, sizeof(SDecoinfo)); |
370 } | 302 } |
371 | 303 |
372 | 304 |
373 float tissue_tolerance(void) | 305 static float tissue_tolerance(void) |
374 { | 306 { |
375 float tissue_inertgas_saturation; | 307 float tissue_inertgas_saturation; |
376 float inertgas_a; | 308 float inertgas_a; |
377 float inertgas_b; | 309 float inertgas_b; |
378 float ceiling; | 310 float ceiling; |
443 } | 375 } |
444 } | 376 } |
445 } | 377 } |
446 | 378 |
447 | 379 |
448 float buehlmann_tissue_test_tolerance(float depth_in_bar_absolute) | 380 static float buehlmann_tissue_test_tolerance(float depth_in_bar_absolute) |
449 { | 381 { |
450 float tissue_inertgas_saturation; | 382 float tissue_inertgas_saturation; |
451 float inertgas_a; | 383 float inertgas_a; |
452 float inertgas_b; | 384 float inertgas_b; |
453 float inertgas_tolerance; | 385 float inertgas_tolerance; |
475 } | 407 } |
476 return tissue_inertgas_saturation - inertgas_tolerance; // negative | 408 return tissue_inertgas_saturation - inertgas_tolerance; // negative |
477 } | 409 } |
478 | 410 |
479 | 411 |
480 void ambient_bar_to_deco_stop_depth_bar(float ceiling) | 412 static void ambient_bar_to_deco_stop_depth_bar(float ceiling) |
481 { | 413 { |
482 int i; | 414 int i; |
483 | 415 |
484 ceiling -= gSurface_pressure_bar; | 416 ceiling -= gSurface_pressure_bar; |
485 | 417 |
487 { | 419 { |
488 gStop.depth = pBuDiveSettings->last_stop_depth_bar; | 420 gStop.depth = pBuDiveSettings->last_stop_depth_bar; |
489 gStop.id = 0; | 421 gStop.id = 0; |
490 return; | 422 return; |
491 } | 423 } |
492 | |
493 | |
494 //for(int i = 1; i < 10; i++) | |
495 | 424 |
496 if((ceiling - pBuDiveSettings->last_stop_depth_bar) <= 0) | 425 if((ceiling - pBuDiveSettings->last_stop_depth_bar) <= 0) |
497 { | 426 { |
498 gStop.depth = pBuDiveSettings->last_stop_depth_bar; | 427 gStop.depth = pBuDiveSettings->last_stop_depth_bar; |
499 gStop.id = 0; | 428 gStop.id = 0; |
516 gStop.depth += i * pBuDiveSettings->input_next_stop_increment_depth_bar; | 445 gStop.depth += i * pBuDiveSettings->input_next_stop_increment_depth_bar; |
517 gStop.id += i; | 446 gStop.id += i; |
518 return; | 447 return; |
519 } | 448 } |
520 | 449 |
521 float next_stop_depth_input_is_actual_stop_id(int actual_id) | 450 static float next_stop_depth_input_is_actual_stop_id(int actual_id) |
522 { | 451 { |
523 if(actual_id == 0) | 452 if(actual_id == 0) |
524 return 0; | 453 return 0; |
525 | 454 |
526 if(actual_id == 1) | 455 if(actual_id == 1) |
528 | 457 |
529 actual_id -= 2; | 458 actual_id -= 2; |
530 return pBuDiveSettings->input_second_to_last_stop_depth_bar + (actual_id * pBuDiveSettings->input_next_stop_increment_depth_bar); | 459 return pBuDiveSettings->input_second_to_last_stop_depth_bar + (actual_id * pBuDiveSettings->input_next_stop_increment_depth_bar); |
531 } | 460 } |
532 | 461 |
533 int ascend_with_all_gaschanges(float pressure_decrease) | 462 static int ascend_with_all_gaschanges(float pressure_decrease) |
534 { | 463 { |
535 float pressureTop, pressureTop_tmp, pressureBottom, pressureChange, ascendrate_in_seconds_for_one_bar, pressure_difference; | 464 float pressureTop, pressureTop_tmp, pressureBottom, pressureChange, ascendrate_in_seconds_for_one_bar, pressure_difference; |
536 int time_for_ascend = 0; | 465 int time_for_ascend = 0; |
537 int seconds; | 466 int seconds; |
538 int i; | 467 int i; |
592 gPressure = pressureTop; | 521 gPressure = pressureTop; |
593 return seconds; | 522 return seconds; |
594 } | 523 } |
595 | 524 |
596 | 525 |
597 float get_gf_at_pressure(float pressure) | 526 static float get_gf_at_pressure(float pressure) |
598 { | 527 { |
599 float gfSteigung = 0.0f; | 528 float gfSteigung = 0.0f; |
600 | 529 |
601 if(gGF_low_depth_bar < 0) | 530 if(gGF_low_depth_bar < 0) |
602 gGF_low_depth_bar = PRESSURE_THREE_METER; // just to prevent erratic behaviour if variable is not set | 531 gGF_low_depth_bar = PRESSURE_THREE_METER; // just to prevent erratic behaviour if variable is not set |
612 | 541 |
613 return (pBuDiveSettings->gf_high - gfSteigung * (pressure - gSurface_pressure_bar) )/ 100.0f; | 542 return (pBuDiveSettings->gf_high - gfSteigung * (pressure - gSurface_pressure_bar) )/ 100.0f; |
614 } | 543 } |
615 | 544 |
616 | 545 |
617 void buehlmann_calc_ndl(void) | 546 static void buehlmann_calc_ndl(void) |
618 { | 547 { |
619 float local_tissue_nitrogen_bar[16]; | 548 float local_tissue_nitrogen_bar[16]; |
620 float local_tissue_helium_bar[16]; | 549 float local_tissue_helium_bar[16]; |
621 int i; | 550 int i; |
622 | 551 |
623 gNDL = 0; | 552 gNDL = 0; |
624 //Check ndl always use gHigh | 553 //Check ndl always use gHigh |
625 gGF_value = ((float)pBuDiveSettings->gf_high) / 100.0f; | 554 gGF_value = ((float)pBuDiveSettings->gf_high) / 100.0f; |
626 //10 minutes steps | 555 //10 minutes steps |
627 while(gNDL < (300 * 60)) | 556 while(gNDL < (300 * 60)) |
628 { | 557 { |
629 memcpy(local_tissue_nitrogen_bar, gTissue_nitrogen_bar, (4*16)); | 558 memcpy(local_tissue_nitrogen_bar, gTissue_nitrogen_bar, (4*16)); |
630 memcpy(local_tissue_helium_bar, gTissue_helium_bar, (4*16)); | 559 memcpy(local_tissue_helium_bar, gTissue_helium_bar, (4*16)); |
631 // | 560 // |
632 gNDL += 600; | 561 gNDL += 600; |
633 decom_tissues_exposure2(600, &pBuDiveSettings->decogaslist[gGas_id], gPressure,gTissue_nitrogen_bar,gTissue_helium_bar); | 562 decom_tissues_exposure2(600, &pBuDiveSettings->decogaslist[gGas_id], gPressure,gTissue_nitrogen_bar,gTissue_helium_bar); |
634 decom_oxygen_calculate_cns_exposure(600,&pBuDiveSettings->decogaslist[gGas_id],gPressure,&gCNS); | 563 decom_oxygen_calculate_cns_exposure(600,&pBuDiveSettings->decogaslist[gGas_id],gPressure,&gCNS); |
635 //tissues_exposure_at_gPressure_seconds(600); | 564 //tissues_exposure_at_gPressure_seconds(600); |
636 buehlmann_backup_and_restore(true); | 565 buehlmann_backup_and_restore(true); |
637 if(dive1_check_deco() == true) | 566 if(dive1_check_deco() == true) |
638 { | 567 { |
672 // =============================================================================== | 601 // =============================================================================== |
673 // dive1_check_deco | 602 // dive1_check_deco |
674 /// @brief for NDL calculations | 603 /// @brief for NDL calculations |
675 /// 160614 using ceilingOther and not ceiling | 604 /// 160614 using ceilingOther and not ceiling |
676 // =============================================================================== | 605 // =============================================================================== |
677 _Bool dive1_check_deco(void) | 606 static _Bool dive1_check_deco(void) |
678 { | 607 { |
679 // gGF_value is set in call routine; | 608 // gGF_value is set in call routine; |
680 // internes Backup! | 609 // internes Backup! |
681 | 610 |
682 // calc like in deco | 611 // calc like in deco |