Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r27e8758fa6199e72b914e1199786a4396ce74d06 -r61061e547ac63df8f0090cc3a3ba81079c88ce9f --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 27e8758fa6199e72b914e1199786a4396ce74d06) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 61061e547ac63df8f0090cc3a3ba81079c88ce9f) @@ -19,6 +19,7 @@ #include "Conductivity.h" #include "ConcentratePumps.h" #include "DialysatePumps.h" +#include "DryBiCart.h" #include "FpgaDD.h" #include "Heaters.h" #include "ModeStandby.h" @@ -41,6 +42,7 @@ #define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. #define BAL_CHAMBER_FILL_PRES_DROP_MS ( 200 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber filling started and corrosponding valves opened. #define BAL_CHAMBER_FILL_COMPLETE_MS ( 300 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber fill completed and pressure is within range +#define DRY_BICARB_CHAMBER_MAX_TIMEOUT_COUNT ( 20 * SEC_PER_MIN ) ///< Periodic bicarb chamber fill request. /// Payload record structure for balancing chamber switch only request typedef struct @@ -71,7 +73,9 @@ static F32 lastTdDialysateFlowrate; ///< Previous TD dialysate flow rate static F32 freshDialPressure; ///< Fresh side dialysate pressure static F32 spentDialPressure; ///< Spent side dialysate pressure - +#ifdef __DRY_BICARB__ +static U32 dryBiCarbChamberFillTimeoutCount; ///< Counter for checking the timeout for drybicart chamber fill request. +#endif // ********** private function prototypes ********** static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillStart( void ); @@ -125,6 +129,9 @@ isPressureDroppedDuringFill = FALSE; freshDialPressure = 0.0F; spentDialPressure = 0.0F; +#ifdef __DRY_BICARB__ + dryBiCarbChamberFillTimeoutCount = 0; +#endif } /*********************************************************************//** @@ -192,6 +199,17 @@ // Increment counter indicating fill is in progress. currentBalChamberSwitchingCounter += 1; +#ifdef __DRY_BICARB__ + //Increment counter for dry bicarb chamber fill + dryBiCarbChamberFillTimeoutCount += 1; + // Fill bicarb chamber once every 60secs. + if ( dryBiCarbChamberFillTimeoutCount >= DRY_BICARB_CHAMBER_MAX_TIMEOUT_COUNT) + { + setBicarbChamberFillRequested(); + dryBiCarbChamberFillTimeoutCount = 0; + } +#endif + // execute current balancing chamber exec state switch ( balChamberExecState ) {