comparison Discovery/Src/tMenuEditPlanner.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 8c0134a287da
comparison
equal deleted inserted replaced
982:22d5b477c903 983:7891160acde3
51 /* Imported variables --------------------------------------------------------*/ 51 /* Imported variables --------------------------------------------------------*/
52 52
53 extern uint16_t tMplan_depth_meter, tMplan_intervall_time_minutes, tMplan_dive_time_minutes, tMplan_depth_editor; 53 extern uint16_t tMplan_depth_meter, tMplan_intervall_time_minutes, tMplan_dive_time_minutes, tMplan_depth_editor;
54 54
55 /* Private variables ---------------------------------------------------------*/ 55 /* Private variables ---------------------------------------------------------*/
56 uint8_t gasChangeListDepthGasId[40]; 56 /*uint8_t gasChangeListDepthGasId[40];*/
57 SgasChangeList gasChangeList[GAS_CHANGE_LIST_ITEMS];
58
57 59
58 /* Private function prototypes -----------------------------------------------*/ 60 /* Private function prototypes -----------------------------------------------*/
59 void openEdit_PlanInterval(void); 61 void openEdit_PlanInterval(void);
60 void openEdit_PlanDiveTime(void); 62 void openEdit_PlanDiveTime(void);
61 void openEdit_PlanMaxDepth(void); 63 void openEdit_PlanMaxDepth(void);
391 SSettings *pSettings = settingsGetPointer(); 393 SSettings *pSettings = settingsGetPointer();
392 uint8_t tMplan_gasConsumTravel = pSettings->gasConsumption_travel_l_min; 394 uint8_t tMplan_gasConsumTravel = pSettings->gasConsumption_travel_l_min;
393 uint8_t tMplan_gasConsumDeco = pSettings->gasConsumption_deco_l_min; 395 uint8_t tMplan_gasConsumDeco = pSettings->gasConsumption_deco_l_min;
394 396
395 resultPage = 0; 397 resultPage = 0;
396 pDecoinfo = simulation_decoplaner(tMplan_depth_meter, tMplan_intervall_time_minutes, tMplan_dive_time_minutes, gasChangeListDepthGasId); 398 pDecoinfo = simulation_decoplaner(tMplan_depth_meter, tMplan_intervall_time_minutes, tMplan_dive_time_minutes, gasChangeList);
397 simulation_gas_consumption(tMplan_pGasConsumption, tMplan_depth_meter, tMplan_dive_time_minutes, pDecoinfo, tMplan_gasConsumTravel, tMplan_gasConsumDeco, gasChangeListDepthGasId); 399 simulation_evaluate_profil( &tMplan_pGasConsumption,
398 simulation_helper_change_points(&tMplan_Summary, tMplan_depth_meter, tMplan_dive_time_minutes, pDecoinfo, gasChangeListDepthGasId); 400 &tMplan_Summary,
401 tMplan_depth_meter, tMplan_dive_time_minutes, tMplan_gasConsumTravel, tMplan_gasConsumDeco,
402 pDecoinfo,
403 gasChangeList);
404 // simulation_gas_consumption(tMplan_pGasConsumption, tMplan_depth_meter, tMplan_dive_time_minutes, pDecoinfo, tMplan_gasConsumTravel, tMplan_gasConsumDeco, gasChangeList);
405 // simulation_helper_change_points(&tMplan_Summary, tMplan_depth_meter, tMplan_dive_time_minutes, pDecoinfo, gasChangeListDepth);
399 406
400 first = 0; 407 first = 0;
401 while((first < DECOINFO_STRUCT_MAX_STOPS-1) && pDecoinfo->output_stop_length_seconds[first+1]) 408 while((first < DECOINFO_STRUCT_MAX_STOPS-1) && pDecoinfo->output_stop_length_seconds[first+1])
402 first++; 409 first++;
403 resultPage = 1; 410 resultPage = 1;
448 GasIdPrev = 0; 455 GasIdPrev = 0;
449 ListCount = 0; 456 ListCount = 0;
450 457
451 for(int i = 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) 458 for(int i = 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++)
452 { 459 {
453 if((stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) 460 if(stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0)
454 #ifdef ENABLE_DECOCALC_OPTION
455 || (stateSimGetPointer()->diveSettings.gas[stateSimGetPointer()->diveSettings.decogaslist[i].GasIdInSettings].note.ub.decocalc == 0)
456 #endif
457 )
458 break; 461 break;
459 depthChange = stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero; 462 depthChange = stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero;
460 if(depthPrev <= depthChange) 463 if(depthPrev <= depthChange)
461 { 464 {
462 GasIdPrev = i; 465 GasIdPrev = i;
467 } 470 }
468 } 471 }
469 472
470 for(int i = GasIdPrev + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++) 473 for(int i = GasIdPrev + 1; i < BUEHLMANN_STRUCT_MAX_GASES; i++)
471 { 474 {
472 if((stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0) 475 if(stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero == 0)
473 #ifdef ENABLE_DECOCALC_OPTION
474 || (stateSimGetPointer()->diveSettings.gas[stateSimGetPointer()->diveSettings.decogaslist[i].GasIdInSettings].note.ub.decocalc == 0)
475 #endif
476 )
477 break; 476 break;
478 depthChange = stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero; 477 depthChange = stateSimGetPointer()->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero;
479 if((depthChange < depthPrev) && (depthChange >= depthNext)) 478 if((depthChange < depthPrev) && (depthChange >= depthNext))
480 { 479 {
481 GasIdNextList[ListCount++] = i; 480 GasIdNextList[ListCount++] = i;