comparison Discovery/Src/logbook.c @ 696:cc542448fb28

Merge
author heinrichsweikamp
date Fri, 19 Aug 2022 11:30:24 +0200
parents b456be1e152d
children
comparison
equal deleted inserted replaced
661:87bee7cc77b3 696:cc542448fb28
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 {
1295 logbook_SetMinTemperature(min_temperature_float_celsius); 1307 logbook_SetMinTemperature(min_temperature_float_celsius);
1296 logbook_SetMaxCNS(pStateReal->lifeData.cns); 1308 logbook_SetMaxCNS(pStateReal->lifeData.cns);
1297 logbook_SetCompartmentDesaturation(pStateReal); 1309 logbook_SetCompartmentDesaturation(pStateReal);
1298 logbook_SetLastStop(pStateReal->diveSettings.last_stop_depth_bar); 1310 logbook_SetLastStop(pStateReal->diveSettings.last_stop_depth_bar);
1299 gheader.batteryVoltage = pStateReal->lifeData.battery_voltage * 1000; 1311 gheader.batteryVoltage = pStateReal->lifeData.battery_voltage * 1000;
1300 gheader.batteryCharge = pStateReal->lifeData.battery_charge; 1312 if(pStateReal->lifeData.battery_charge > 0.0)
1313 {
1314 gheader.batteryCharge = pStateReal->lifeData.battery_charge;
1315 }
1316 else
1317 {
1318 gheader.batteryCharge = 0.0;
1319 }
1301 logbook_EndDive(); 1320 logbook_EndDive();
1302 bDiveMode = 0; 1321 bDiveMode = 0;
1303 } else 1322 } else
1304 { 1323 {
1305 ext_flash_enable_protection(); 1324 ext_flash_enable_protection();