comparison Discovery/Src/logbook.c @ 662:1b995079c045 Betatest

PSCR Mode
author heinrichs weikamp
date Tue, 14 Dec 2021 15:36:10 +0100
parents 4eba86129d35
children b456be1e152d
comparison
equal deleted inserted replaced
661:87bee7cc77b3 662:1b995079c045
1000 { 1000 {
1001 if(header.gasordil[i].note.ub.first) 1001 if(header.gasordil[i].note.ub.first)
1002 break; 1002 break;
1003 } 1003 }
1004 firstgasid = i + 1; 1004 firstgasid = i + 1;
1005 if(header.diveMode == DIVEMODE_CCR) 1005 if(isLoopMode(header.diveMode))
1006 setPointLast = header.setpoint[0].setpoint_cbar; 1006 setPointLast = header.setpoint[0].setpoint_cbar;
1007 else 1007 else
1008 setPointLast = 0; 1008 setPointLast = 0;
1009 //diveTime_seconds = header.diveTime_seconds ; 1009 //diveTime_seconds = header.diveTime_seconds ;
1010 for(compression = 1; compression < 100; compression ++) 1010 for(compression = 1; compression < 100; compression ++)
1164 //Calc ppo2 - Values 1164 //Calc ppo2 - Values
1165 SGas gas; 1165 SGas gas;
1166 gas.setPoint_cbar = setPointVal; 1166 gas.setPoint_cbar = setPointVal;
1167 if(gasidVal > 0) 1167 if(gasidVal > 0)
1168 { 1168 {
1169 if((gasidVal >= NUM_GASES) && (header.diveMode == DIVEMODE_PSCR)) /* in case gas switches the absolute gas ID is used => map to the 0..NUM_GASES index used in header */
1170 {
1171 gasidVal -= NUM_GASES;
1172 }
1169 gas.helium_percentage = header.gasordil[gasidVal - 1].helium_percentage; 1173 gas.helium_percentage = header.gasordil[gasidVal - 1].helium_percentage;
1170 gas.nitrogen_percentage = 100 - gas.helium_percentage - header.gasordil[gasidVal - 1].oxygen_percentage; 1174 gas.nitrogen_percentage = 100 - gas.helium_percentage - header.gasordil[gasidVal - 1].oxygen_percentage;
1171 } 1175 }
1172 else 1176 else
1173 { 1177 {
1174 gas.helium_percentage = manualGasVal.percentageHe; 1178 gas.helium_percentage = manualGasVal.percentageHe;
1175 gas.nitrogen_percentage = 100 - gas.helium_percentage - manualGasVal.percentageO2; 1179 gas.nitrogen_percentage = 100 - gas.helium_percentage - manualGasVal.percentageO2;
1176 } 1180 }
1177 ambiant_pressure_bar =((float)(depthVal + header.surfacePressure_mbar))/1000; 1181 ambiant_pressure_bar =((float)(depthVal + header.surfacePressure_mbar))/1000;
1178 ppO2 = decom_calc_ppO2(ambiant_pressure_bar, &gas ); 1182
1183 if(header.diveMode == DIVEMODE_PSCR)
1184 {
1185 ppO2 = decom_calc_SimppO2(ambiant_pressure_bar, &gas);
1186 }
1187 else /* open circuit calculation */
1188 {
1189 ppO2 = decom_calc_ppO2(ambiant_pressure_bar, &gas);
1190 }
1179 ppo2[iNum] = (uint16_t) ( ppO2 * 100); 1191 ppo2[iNum] = (uint16_t) ( ppO2 * 100);
1180 } 1192 }
1181 1193
1182 if(tank) 1194 if(tank)
1183 { 1195 {