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 ) { Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rff1b8b02621afef8e65d68f8253662ac86a83479 -r61061e547ac63df8f0090cc3a3ba81079c88ce9f --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision ff1b8b02621afef8e65d68f8253662ac86a83479) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision 61061e547ac63df8f0090cc3a3ba81079c88ce9f) @@ -66,11 +66,12 @@ static U32 lastFillDurationInMS; ///< Previous time duration to fill the bicart fill. static U32 currentFillDurationInMS; ///< Current time duartion to fill the bicart fill. static OVERRIDE_U32_T dryBiCartFillRequested; ///< Start/stop Dry bicart fill. -static OVERRIDE_U32_T bicarbChamberFillRequested; ///< Start/stop Bicarb chamber fill. static OVERRIDE_U32_T dryBiCartDataPublishInterval; ///< Dry bicart data publish interval. static U32 dryBiCartDataPublicationTimerCounter; ///< Used to schedule drybicart data publication to CAN bus. static U32 dryBiCarbSupplyStartTime; ///< Bicarb supply start time from bicart to Chamber F. +static OVERRIDE_U32_T bicarbChamberFillRequested; ///< Start/stop Bicarb chamber fill. + // ********** private function prototypes ********** static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillWaterStartState( void ); @@ -428,6 +429,7 @@ if ( TRUE == getU32OverrideValue( &bicarbChamberFillRequested ) ) { bicarbChamberFillExecState = BICARB_CHAMBER_CHECK_LEVEL_STATE; + bicarbChamberFillRequested.data = FALSE; } break; @@ -547,6 +549,19 @@ /*********************************************************************//** * @brief + * The setBicarbChamberFillRequested function sets the chmaberFillRequest + * flag value to be True. + * @details \b Inputs: none + * @details \b Outputs: none + * @return none. + *************************************************************************/ +void setBicarbChamberFillRequested( void ) +{ + bicarbChamberFillRequested.data = TRUE; +} + +/*********************************************************************//** + * @brief * The publishDryBicartData function broadcasts the dry bicart * data at defined interval. * @details \b Inputs: dryBiCartDataPublicationTimerCounter Index: firmware/App/Controllers/DryBiCart.h =================================================================== diff -u -rc5ffb798313c4179717f45b6485cebcb45e6fd5d -r61061e547ac63df8f0090cc3a3ba81079c88ce9f --- firmware/App/Controllers/DryBiCart.h (.../DryBiCart.h) (revision c5ffb798313c4179717f45b6485cebcb45e6fd5d) +++ firmware/App/Controllers/DryBiCart.h (.../DryBiCart.h) (revision 61061e547ac63df8f0090cc3a3ba81079c88ce9f) @@ -52,6 +52,7 @@ U32 execDryBicartFillMode( void ); // Execute the dry bicart state machine U32 execBicarbChamberFillMode( void ); // Execute the bicarb chamber fill state machine void execDryBicart( void ); // Execute the list of drybicart state machines +void setBicarbChamberFillRequested( void ); // Sets the Flag for dry bicarb chamber fill request data to be true DRY_BICART_FILL_EXEC_STATE_T getCurrentDryBiCartFillExecState( void ); // Get the current state of the dry bicart fill execution