comparison Discovery/Src/simulation.c @ 1058:3c73180fde1d Icon_Integration tip

Added log entry for surface GF: The surface GF has been added to the logbook data. A function records the GF which is present while entering close to surface condition for later storage. This is needed to avoid that an already decreased GF (after dive mode exit time) GF is stored. The surface GF is shown at logbook page1 and is available in the header data for external logbook services.
author Ideenmodellierer
date Sat, 10 Jan 2026 19:53:01 +0100
parents 8c0134a287da
children
comparison
equal deleted inserted replaced
1057:24c1e3367a2e 1058:3c73180fde1d
298 if(is_ambient_pressure_close_to_surface(&pDiveState->lifeData)) // new hw 170214 298 if(is_ambient_pressure_close_to_surface(&pDiveState->lifeData)) // new hw 170214
299 { 299 {
300 if(!(stateSimGetPointer()->lifeData.counterSecondsShallowDepth)) 300 if(!(stateSimGetPointer()->lifeData.counterSecondsShallowDepth))
301 { 301 {
302 if(pDiveState->diveSettings.diveMode != DIVEMODE_Apnea) 302 if(pDiveState->diveSettings.diveMode != DIVEMODE_Apnea)
303 {
303 pDiveState->lifeData.counterSecondsShallowDepth = settingsGetPointer()->timeoutDiveReachedZeroDepth - 15; 304 pDiveState->lifeData.counterSecondsShallowDepth = settingsGetPointer()->timeoutDiveReachedZeroDepth - 15;
305 if(pDiveState->diveSettings.deco_type.ub.standard == GF_MODE)
306 {
307 if((stateDeco.decolistBuehlmann.gf_surf * 100.0) < 255.0)
308 {
309 pDiveState->lifeData.gf_surf_log = stateDeco.decolistBuehlmann.gf_surf *100.0;
310 }
311 else
312 {
313 pDiveState->lifeData.gf_surf_log = 255;
314 }
315 }
316 }
304 else 317 else
305 { 318 {
306 pDiveState->lifeData.apnea_last_dive_time_seconds = pDiveState->lifeData.dive_time_seconds; 319 pDiveState->lifeData.apnea_last_dive_time_seconds = pDiveState->lifeData.dive_time_seconds;
307 if(pDiveState->lifeData.apnea_last_dive_time_seconds > pDiveState->lifeData.dive_time_seconds_without_surface_time) 320 if(pDiveState->lifeData.apnea_last_dive_time_seconds > pDiveState->lifeData.dive_time_seconds_without_surface_time)
308 pDiveState->lifeData.apnea_last_dive_time_seconds = pDiveState->lifeData.dive_time_seconds_without_surface_time; 321 pDiveState->lifeData.apnea_last_dive_time_seconds = pDiveState->lifeData.dive_time_seconds_without_surface_time;
349 362
350 if(stateSimGetPointer()->lifeData.counterSecondsShallowDepth) 363 if(stateSimGetPointer()->lifeData.counterSecondsShallowDepth)
351 { 364 {
352 stateSimGetPointerWrite()->lifeData.counterSecondsShallowDepth += 1; 365 stateSimGetPointerWrite()->lifeData.counterSecondsShallowDepth += 1;
353 if(stateSimGetPointer()->lifeData.counterSecondsShallowDepth >= settingsGetPointer()->timeoutDiveReachedZeroDepth) 366 if(stateSimGetPointer()->lifeData.counterSecondsShallowDepth >= settingsGetPointer()->timeoutDiveReachedZeroDepth)
367 {
368 #ifdef SIM_WRITES_LOGBOOK
369 pDiveState->mode = MODE_SURFACE;
370 logbook_InitAndWrite((SDiveState*)pDiveState);
371 #endif
354 simulation_exit(); 372 simulation_exit();
373 }
355 } 374 }
356 vpm_crush(pDiveState); 375 vpm_crush(pDiveState);
357 } 376 }
358 377
359 /** 378 /**