Mercurial > public > ostc4
diff Discovery/Src/logbook.c @ 696:cc542448fb28
Merge
author | heinrichsweikamp |
---|---|
date | Fri, 19 Aug 2022 11:30:24 +0200 |
parents | b456be1e152d |
children | 63c340abd70e |
line wrap: on
line diff
--- a/Discovery/Src/logbook.c Mon Nov 01 12:39:34 2021 +0100 +++ b/Discovery/Src/logbook.c Fri Aug 19 11:30:24 2022 +0200 @@ -1002,7 +1002,7 @@ break; } firstgasid = i + 1; - if(header.diveMode == DIVEMODE_CCR) + if(isLoopMode(header.diveMode)) setPointLast = header.setpoint[0].setpoint_cbar; else setPointLast = 0; @@ -1166,6 +1166,10 @@ gas.setPoint_cbar = setPointVal; if(gasidVal > 0) { + 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 */ + { + gasidVal -= NUM_GASES; + } gas.helium_percentage = header.gasordil[gasidVal - 1].helium_percentage; gas.nitrogen_percentage = 100 - gas.helium_percentage - header.gasordil[gasidVal - 1].oxygen_percentage; } @@ -1175,7 +1179,15 @@ gas.nitrogen_percentage = 100 - gas.helium_percentage - manualGasVal.percentageO2; } ambiant_pressure_bar =((float)(depthVal + header.surfacePressure_mbar))/1000; - ppO2 = decom_calc_ppO2(ambiant_pressure_bar, &gas ); + + if(header.diveMode == DIVEMODE_PSCR) + { + ppO2 = decom_calc_SimppO2(ambiant_pressure_bar, &gas); + } + else /* open circuit calculation */ + { + ppO2 = decom_calc_ppO2(ambiant_pressure_bar, &gas); + } ppo2[iNum] = (uint16_t) ( ppO2 * 100); } @@ -1297,7 +1309,14 @@ logbook_SetCompartmentDesaturation(pStateReal); logbook_SetLastStop(pStateReal->diveSettings.last_stop_depth_bar); gheader.batteryVoltage = pStateReal->lifeData.battery_voltage * 1000; - gheader.batteryCharge = pStateReal->lifeData.battery_charge; + if(pStateReal->lifeData.battery_charge > 0.0) + { + gheader.batteryCharge = pStateReal->lifeData.battery_charge; + } + else + { + gheader.batteryCharge = 0.0; + } logbook_EndDive(); bDiveMode = 0; } else