Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r6419179374edcd65da462de84e8aeaefb7e20320 -r7bbf1fb04f7e4788c3072ca173413ed052c608d3 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 6419179374edcd65da462de84e8aeaefb7e20320) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 7bbf1fb04f7e4788c3072ca173413ed052c608d3) @@ -16,13 +16,14 @@ ***************************************************************************/ #include "DialInFlow.h" +#include "Dialysis.h" #include "DGDefs.h" +#include "DGInterface.h" #include "ModeInitPOST.h" #include "ModeTreatment.h" #include "OperationModes.h" #include "SystemCommMessages.h" #include "Timers.h" -#include "DGInterface.h" /** * @addtogroup DGInterface @@ -670,7 +671,7 @@ loadCellWeightInGrams[ LOAD_CELL_RESERVOIR_2_PRIMARY ].data = res2Primary; loadCellWeightInGrams[ LOAD_CELL_RESERVOIR_2_BACKUP ].data = res2Backup; - // feed new weight samples into filters and update moving averages + // Feed new weight samples into filters and update moving averages for ( res = DG_RESERVOIR_1; res < NUM_OF_DG_RESERVOIRS; res++ ) { F32 wt = ( res == DG_RESERVOIR_1 ? res1Primary : res2Primary ); @@ -680,6 +681,9 @@ lgFilteredReservoirWeightInGrams[ res ] = lgLoadCellReadingsTotal[ res ] / (F32)SIZE_OF_LARGE_LOAD_CELL_AVG; } lgLoadCellReadingsIdx = INC_WRAP( lgLoadCellReadingsIdx, 0, SIZE_OF_LARGE_LOAD_CELL_AVG - 1 ); + + // Update Dialysis sub-mode with new reservoir volumes + updateReservoirVolumes( res1Primary, res2Primary ); } /*********************************************************************//** Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r3533955f242cec0505e8826e0e2d96f7b79ad499 -r7bbf1fb04f7e4788c3072ca173413ed052c608d3 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 3533955f242cec0505e8826e0e2d96f7b79ad499) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 7bbf1fb04f7e4788c3072ca173413ed052c608d3) @@ -663,7 +663,8 @@ * @return none *************************************************************************/ void execPresOcclTest( void ) -{ +{ +#ifndef DISABLE_PRESSURE_CHECKS U32 const bpPressure = getMeasuredBloodPumpOcclusion(); U32 const dialysateInPressure = getMeasuredDialInPumpOcclusion(); U32 const dialysateOutPressure = getMeasuredDialOutPumpOcclusion(); @@ -694,6 +695,7 @@ { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_VENOUS_PRESSURE_SELF_TEST_FAILURE, venousPressure ); } +#endif } /*********************************************************************//** Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -rc08182ef9b9ae04e8d3a0aae96c015ce0f7a2fa5 -r7bbf1fb04f7e4788c3072ca173413ed052c608d3 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision c08182ef9b9ae04e8d3a0aae96c015ce0f7a2fa5) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 7bbf1fb04f7e4788c3072ca173413ed052c608d3) @@ -62,6 +62,8 @@ static F32 measUFVolume; ///< Current total measured volume for ultrafiltration (Where are we w/r/t ultrafiltration). static F32 resStartVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir start volume for ultrafiltration (i.e. where did we start with each reservoir). static F32 resFinalVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir final volume for ultrafiltration (i.e. where did we end after switch with each reservoir). +static F32 resCurrVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir current volume. +static F32 resLastVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir previous volume. static F32 measUFVolumeFromPriorReservoirs; ///< Current total ultrafiltration volume from previous reservoirs in current treatment. static U32 uFTimeMS; ///< Current elapsed ultrafiltration time (in ms). Used for calculating UF reference volume. @@ -1068,7 +1070,7 @@ LOAD_CELL_ID_T loadCell = ( activeRes == DG_RESERVOIR_1 ? LOAD_CELL_RESERVOIR_1_PRIMARY : LOAD_CELL_RESERVOIR_2_PRIMARY ); F32 latestResVolume = getLoadCellWeight( loadCell ); #ifndef DISABLE_UF_ALARMS - F32 deltaVolume = latestResVolume - resFinalVolume[ activeRes ]; + F32 deltaVolume = latestResVolume - resLastVolume[ activeRes ]; // ensure volume change is not too excessive - indication that load cell was impacted by some kind of shock if ( fabs(deltaVolume) > MAX_ACTIVE_LOAD_CELL_CHANGE_G ) @@ -1142,4 +1144,22 @@ measUFVolumeFromPriorReservoirs += ( resFinalVolume[ inactiveRes ] - resStartVolume[ inactiveRes ] ); } +/*********************************************************************//** + * @brief + * The updateReservoirVolumes function updates the reservoir volumes based + * on new load cell readings. + * @details Inputs: none + * @details Outputs: resCurrVolume[], resLastVolume[] + * @param res1Vol new volume for reservoir 1 + * @param res2Vol new volume for reservoir 2 + * @return none + *************************************************************************/ +void updateReservoirVolumes( F32 res1Vol, F32 res2Vol ) +{ + resLastVolume[ DG_RESERVOIR_1 ] = resCurrVolume[ DG_RESERVOIR_1 ]; + resLastVolume[ DG_RESERVOIR_2 ] = resCurrVolume[ DG_RESERVOIR_2 ]; + resCurrVolume[ DG_RESERVOIR_1 ] = res1Vol; + resCurrVolume[ DG_RESERVOIR_2 ] = res2Vol; +} + /**@}*/ Index: firmware/App/Modes/Dialysis.h =================================================================== diff -u -rbb80dbac26147ab08413efa91007f7ffed43c38f -r7bbf1fb04f7e4788c3072ca173413ed052c608d3 --- firmware/App/Modes/Dialysis.h (.../Dialysis.h) (revision bb80dbac26147ab08413efa91007f7ffed43c38f) +++ firmware/App/Modes/Dialysis.h (.../Dialysis.h) (revision 7bbf1fb04f7e4788c3072ca173413ed052c608d3) @@ -73,6 +73,7 @@ void setStartReservoirVolume( DG_RESERVOIR_ID_T reservoirID ); void signalReservoirsSwitched( void ); void setFinalReservoirVolume( void ); +void updateReservoirVolumes( F32 res1Vol, F32 res2Vol ); /**@}*/