Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -rddc20ee738e1c688d5a16e2f3f94613d3663597d -ra4669c80291e85fa5ce17d77ebcfd0c882831202 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision ddc20ee738e1c688d5a16e2f3f94613d3663597d) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision a4669c80291e85fa5ce17d77ebcfd0c882831202) @@ -8,7 +8,7 @@ * @file Reservoirs.c * * @author (last) Dara Navaei -* @date (last) 23-May-2022 +* @date (last) 03-Aug-2022 * * @author (original) Sean * @date (original) 18-Mar-2020 @@ -51,7 +51,7 @@ #define MAX_REDUNDANT_LOAD_CELL_DIFF 50.0F ///< Maximum difference in redundant load cells when determining if fill completed. #define MAX_DRAIN_RPM_MLP 2400.0F ///< Maximum drain RPM in mL/min. #define DATA_PUBLISH_COUNTER_START_COUNT 5 ///< Data publish counter start count. -#define ENVIRONMENT_TEMPERATURE_C 23.5F ///< Device's environment temperature in C. // TODo add this to the cal records +#define ENVIRONMENT_TEMPERATURE_C 23.5F ///< Device's environment temperature in C. // TODO add this to the cal records // ********** private data ********** @@ -260,8 +260,8 @@ { DG_CMD_RESPONSE_T cmdResponse; - cmdResponse.commandID = DG_CMD_VALVE_SETTING; - cmdResponse.rejected = TRUE; + cmdResponse.commandID = DG_CMD_VALVE_SETTING; + cmdResponse.rejected = TRUE; cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; // valve setting command only valid in generation idle mode @@ -590,7 +590,7 @@ F32 fillPart = ( ( targetFillVolML - heatingConstsCalRecord.ultrafilterVolmL ) / targetFillVolML ) * tempAvgFill; F32 tempReservoir0Actual = ultrafilterPart + fillPart; - F32 tempReservoirEndfillActual = tempReservoir0Actual + ( ( heatersTempCalc.timeReservoirFillMS * 0.5 ) * RsrvrTauCPerMS ); + F32 tempReservoirEndfillActual = tempReservoir0Actual + ( ( heatersTempCalc.timeReservoirFillMS * HALF ) * RsrvrTauCPerMS ); heatersTempCalc.tempReservoirUseActual = tempReservoirEndfillActual + ( heatersTempCalc.timeReservoirFill2SwitchMS * RsrvrTauCPerMS ); } else @@ -632,7 +632,7 @@ tempReservoirUse = heatersTempCalc.tempTargetTrimmer + RESERVOIR_EXTRA_TEMPERATURE; heatersTempCalc.tempReservoirEndFill = tempReservoirUse - ( heatersTempCalc.timeReservoirFill2SwitchMS * RsrvrTauCPerMS ); - heatersTempCalc.tempReservoir0 = heatersTempCalc.tempReservoirEndFill - ( ( heatersTempCalc.timeReservoirFillMS * 0.5 ) * RsrvrTauCPerMS ); + heatersTempCalc.tempReservoir0 = heatersTempCalc.tempReservoirEndFill - ( ( heatersTempCalc.timeReservoirFillMS * HALF ) * RsrvrTauCPerMS ); heatersTempCalc.timeUFDecayMS = (F32)heatersTempCalc.timeReservoirCycleMS - heatersTempCalc.timeReservoirFillMS; UFTimeConstant = heatersTempCalc.timeUFDecayMS * UFTauCPerMS; @@ -688,9 +688,9 @@ ( ( ( targetFillVolML - heatingConstsCalRecord.ultrafilterVolmL ) / targetFillVolML ) * heatersTempCalc.tempFillMixAvgTrimmer ); - heatersTempCalc.tempRsrvrEndFillTrimmer = heatersTempCalc.tempRsrvr0ActualTrimmer + ( ( heatersTempCalc.timeReservoirFillMS * 0.5 ) * rsrvrTauCPerMS ); + heatersTempCalc.tempRsrvrEndFillTrimmer = heatersTempCalc.tempRsrvr0ActualTrimmer + ( ( heatersTempCalc.timeReservoirFillMS * HALF ) * rsrvrTauCPerMS ); - tempRsrvrActual = heatersTempCalc.tempRsrvrEndFillTrimmer + ( ( heatersTempCalc.timeReservoirFillMS * 0.5 ) * rsrvrTauCPerMS ); + tempRsrvrActual = heatersTempCalc.tempRsrvrEndFillTrimmer + ( ( heatersTempCalc.timeReservoirFillMS * HALF ) * rsrvrTauCPerMS ); } return tempRsrvrActual;