comparison Discovery/Src/buehlmann.c @ 983:7891160acde3 GasConsumption

Bugfix calculation of needed gas: Sometimes a gas was not calculated because of it's change depth calculation. Rootcause was a problem in the setup of the gas change list. The old function collecting milestones like time to first stop etc. has been removed because after the deco compression the complete profile is available. Instead of doing another way of profile calculation the existing profil is now evaluated and the time stamps / gas consumption derived from there.
author Ideenmodellierer
date Sun, 02 Mar 2025 21:43:08 +0100
parents 79b522fbabe6
children d91345e9c009
comparison
equal deleted inserted replaced
982:22d5b477c903 983:7891160acde3
256 } while(next_depth == -1); 256 } while(next_depth == -1);
257 tts_seconds += ascend_time; 257 tts_seconds += ascend_time;
258 gStop.depth = next_depth; 258 gStop.depth = next_depth;
259 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) 259 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++)
260 { 260 {
261 if((pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) 261 if(pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0)
262 #ifdef ENABLE_DECOCALC_OPTION
263 || (pDiveSettings->gas[pDiveSettings->decogaslist[i].GasIdInSettings].note.ub.decocalc == 0)
264 #endif
265 )
266 { 262 {
267 break; 263 break;
268 } 264 }
269 float pressureChange = ((float)pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero) / 10; 265 float pressureChange = ((float)pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero) / 10;
270 if(gStop.depth <= pressureChange + 0.00001f) 266 if(gStop.depth <= pressureChange + 0.00001f)
462 seconds = 0; 458 seconds = 0;
463 do{ 459 do{
464 pressureTop_tmp = pressureTop; 460 pressureTop_tmp = pressureTop;
465 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) 461 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++)
466 { 462 {
467 if((pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) 463 if(pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0)
468 #ifdef ENABLE_DECOCALC_OPTION
469 || (pDiveSettings->gas[pDiveSettings->decogaslist[i].GasIdInSettings].note.ub.decocalc == 0)
470 #endif
471 )
472 { 464 {
473 break; 465 break;
474 } 466 }
475 pressureChange = gSurface_pressure_bar + ((float)pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero) / 10; 467 pressureChange = gSurface_pressure_bar + ((float)pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero) / 10;
476 if(pressureBottom <= pressureChange) 468 if(pressureBottom <= pressureChange)
483 } 475 }
484 476
485 } 477 }
486 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) 478 for(i = gGas_id + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++)
487 { 479 {
488 if((pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) 480 if(pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0)
489 #ifdef ENABLE_DECOCALC_OPTION
490 || (pDiveSettings->gas[pDiveSettings->decogaslist[i].GasIdInSettings].note.ub.decocalc == 0)
491 #endif
492 )
493 { 481 {
494 break; 482 break;
495 } 483 }
496 484
497 pressureChange = gSurface_pressure_bar + ((float)pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero)/ 10; 485 pressureChange = gSurface_pressure_bar + ((float)pDiveSettings->decogaslist[i].change_during_ascent_depth_meter_otherwise_zero)/ 10;