diff Common/Src/decom.c @ 684:9bc817e9e221 Betatest

Ignore automatic setpoint changes during ascend: In the previous version setpoint changes which have been configured for descending were considered for deco calculation in case one or more additional diluents have been activated. This procedure does not fit to the common way to keep setpoint high till end of the dive in order to get rid of the deco time. In the new implementation the OSTC assumes that the current setpoint is used till the end of the dive.
author Ideenmodellierer
date Thu, 02 Jun 2022 20:24:59 +0200
parents 1b995079c045
children 012f94ec2fe0
line wrap: on
line diff
--- a/Common/Src/decom.c	Mon May 16 20:50:26 2022 +0200
+++ b/Common/Src/decom.c	Thu Jun 02 20:24:59 2022 +0200
@@ -637,15 +637,15 @@
 			//divmode CCR or PSCR
 				for(i=6; i <= 10; i++)
 				{
-						if(pInput->gas[i].note.ub.active && pInput->gas[i].depth_meter
+						if((pInput->gas[i].note.ub.active) && (pInput->gas[i].depth_meter)
 							 && (pLifeData->actualGas.GasIdInSettings != i)
-							 &&(pInput->gas[i].depth_meter < pLifeData->depth_meter ) )
+							 && (pInput->gas[i].depth_meter < pLifeData->depth_meter ))
 						{
 								count = 1;
 								for(j=6;j<= 10;j++)
 								{
 //                    if(pInput->gas[j].note.ub.active && pInput->gas[j].depth_meter > 0 &&pInput->gas[j].depth_meter > pInput->gas[i].depth_meter)
-										if(			(pInput->gas[j].note.ub.active && pInput->gas[j].depth_meter > 0)
+										if(((pInput->gas[j].note.ub.active) && (pInput->gas[j].depth_meter > 0))
 												&&	(pLifeData->actualGas.GasIdInSettings != j) // new hw 160905
 												&&	(pInput->gas[j].depth_meter > pInput->gas[i].depth_meter))
 												count++;
@@ -661,60 +661,14 @@
 								else
 								{
 									pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].oxygen_percentage;
+									pInput->decogaslist[count].AppliedDiveMode = DIVEMODE_CCR;
+									pInput->decogaslist[count].setPoint_cbar = pInput->decogaslist[0].setPoint_cbar;		/* assume that current setpoint is kept till end of the dive */
 								}
 								pInput->decogaslist[count].nitrogen_percentage -= pInput->gas[i].helium_percentage;
 								pInput->decogaslist[count].helium_percentage = pInput->gas[i].helium_percentage;
 								pInput->decogaslist[count].GasIdInSettings = i;
-
 						}
 				}
-				if(pInput->diveMode == DIVEMODE_CCR)
-				{
-					/* Include Setpoint Changes */
-					for(j=0; j <= count; j++)
-					{
-						uint8_t depth = 0;
-						uint8_t changedepth = 0;
-						char newSetpoint;
-
-						pInput->decogaslist[j].AppliedDiveMode = DIVEMODE_CCR;
-						if(j == 0)
-						{
-							depth = pLifeData->depth_meter;
-						}
-						else
-						{
-							//no setpointchange ?
-							pInput->decogaslist[j].setPoint_cbar =  pInput->decogaslist[j - 1].setPoint_cbar;
-							depth = pInput->decogaslist[j].change_during_ascent_depth_meter_otherwise_zero + 0.1f;
-						}
-						/* Setpoint change at the same depth as gas changes */
-						if(nextSetpointChange(pInput,depth + 1, &changedepth,&newSetpoint) && changedepth == depth)
-						{
-							 pInput->decogaslist[j].setPoint_cbar = newSetpoint;
-						}
-						/* Setpoint changes inbetween gas changes */
-						while(nextSetpointChange(pInput, depth, &changedepth,&newSetpoint)
-								&& (
-											( (j < count) && (changedepth > pInput->decogaslist[j + 1].change_during_ascent_depth_meter_otherwise_zero))
-											|| ((j == count) && (changedepth > 0))
-									 ))
-						{
-							//Include new entry with setpoint change in decogaslist
-							for(int k = count; k > j; k--)
-							{
-									 pInput->decogaslist[k+1] = pInput->decogaslist[k];
-							}
-							pInput->decogaslist[j + 1] =  pInput->decogaslist[j];
-							pInput->decogaslist[j + 1].setPoint_cbar = newSetpoint;
-							j++;
-							count++;
-							depth = changedepth;
-						}
-
-					}
-
-				}
 		}
 }
 void test_decom_CreateGasChangeList(void)