Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r2a1296e1269e7c36dd07cb0f39b70b742f6de405 -r977f03e20990ed5579160b9b927df1c0f2428101 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 2a1296e1269e7c36dd07cb0f39b70b742f6de405) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 977f03e20990ed5579160b9b927df1c0f2428101) @@ -846,6 +846,19 @@ /*********************************************************************//** * @brief + * The getBalChamberSwitchingPeriod function gets the balancing chamber + * switching period. + * @details \b Inputs: balChamberSwitchingPeriod + * @details \b Outputs: none + * @return balancing chamber switching period + *************************************************************************/ +U32 getBalChamberSwitchingPeriod( void ) +{ + return balChamberSwitchingPeriod; +} + +/*********************************************************************//** + * @brief * The getBalChamberDataPublishInterval function gets the balancing chamber * data publish interval. * @details \b Inputs: balChamberDataPublishInterval Index: firmware/App/Controllers/BalancingChamber.h =================================================================== diff -u -rb13fc4db3591da73c3c63e81a69be3f9d0de2c3f -r977f03e20990ed5579160b9b927df1c0f2428101 --- firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision b13fc4db3591da73c3c63e81a69be3f9d0de2c3f) +++ firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision 977f03e20990ed5579160b9b927df1c0f2428101) @@ -68,6 +68,7 @@ void valveControlForBCFreshSideOnlyOpenState( void ); // Open only fresh side balancing chamber valves BOOL getBalChamberSwitchingOnlyStatus( void ); // Get balancing chamber switching only status void setBalChamberSwitchingOnlyStatus( BOOL OnOff ); // Set balancing chamber switching only status +U32 getBalChamberSwitchingPeriod( void ); // Get balancing chamber switching period BOOL testDDBalChamberDataPublishIntervalOverride( MESSAGE_T *message ); // To override the balancing chamber data publish interval BOOL testBalChamberSwFreqOverride( MESSAGE_T *message ); // To override the balancing chamber switching frequency Index: firmware/App/DDCommon.h =================================================================== diff -u -r2a1296e1269e7c36dd07cb0f39b70b742f6de405 -r977f03e20990ed5579160b9b927df1c0f2428101 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 2a1296e1269e7c36dd07cb0f39b70b742f6de405) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 977f03e20990ed5579160b9b927df1c0f2428101) @@ -54,6 +54,9 @@ //Uncomment below once characterization/study completed //#define ENABLE_ALARM_2 +//Uncomment below for spent chamber filling +#define __SPENT_CHAMBER_FILL__ 1 + //Uncomment below if balancing chamber pressure alarm is required #define __BC_PRESSURE_ALARM__ 1 Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r573a26b2a0273a4983b1de1cbff5bed63e01dce0 -r977f03e20990ed5579160b9b927df1c0f2428101 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 573a26b2a0273a4983b1de1cbff5bed63e01dce0) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 977f03e20990ed5579160b9b927df1c0f2428101) @@ -28,6 +28,7 @@ #include "OperationModes.h" #include "PersistentAlarm.h" #include "Pressure.h" +#include "SpentChamberFill.h" #include "TaskGeneral.h" #include "TDInterface.h" #include "Temperature.h" @@ -87,10 +88,9 @@ static DD_GEND_MODE_STATE_T handleGenDDialysateBypassState( void ); static DD_GEND_MODE_STATE_T handleGenDDialysateDeliveryState( void ); static DD_GEND_MODE_STATE_T handleGenDDialysateDeliveryPauseState( void ); -static DD_GEND_MODE_STATE_T handleGenDDialysateIsolatedUFState( void ); -static F32 getGenDialysateTargetTemperature( void ); +static DD_GEND_MODE_STATE_T handleGenDSpentChamberFillState(void); +static DD_GEND_MODE_STATE_T handleGenDIsolatedUFState( void ); static void checkDialysateTemperature( void ); -static void calculateTargetDialysateTemp( void ); static void publishGenDialysateModeData( void ); /*********************************************************************//** @@ -319,12 +319,16 @@ genDialysateState = handleGenDDialysateDeliveryState(); break; + case DD_GEND_SPENT_CHAMBER_FILL_STATE: + genDialysateState = handleGenDSpentChamberFillState(); + break; + case DD_GEND_DIALYSATE_DELIVERY_PAUSE: genDialysateState = handleGenDDialysateDeliveryPauseState(); break; case DD_GEND_ISOLATED_UF_STATE: - genDialysateState = handleGenDDialysateIsolatedUFState(); + genDialysateState = handleGenDIsolatedUFState(); break; default: @@ -383,7 +387,7 @@ * @details \b Outputs: Adjusted Target temperature * @return none. *************************************************************************/ -static void calculateTargetDialysateTemp( void ) +void calculateTargetDialysateTemp( void ) { // Get the dialysate flow rate from TD F32 dialFlowrate = getTDDialysateFlowrate(); @@ -414,7 +418,7 @@ * @details \b Outputs: none * @return the current state of gen dialysate mode *************************************************************************/ -static DD_GEND_MODE_STATE_T handleGenDDialysateIsolatedUFState( void ) +static DD_GEND_MODE_STATE_T handleGenDIsolatedUFState( void ) { DD_GEND_MODE_STATE_T state = DD_GEND_ISOLATED_UF_STATE; @@ -491,7 +495,37 @@ return state; } +/*********************************************************************//** + * @brief + * The handleGenDSpentChamberFillState function performing spent + * chamber filling/degassing by executing balancing chamber. + * @details \b Inputs: none + * @details \b Outputs: balancing chamber state. + * @return the current state of gen dialysate mode + *************************************************************************/ +static DD_GEND_MODE_STATE_T handleGenDSpentChamberFillState( void ) +{ + DD_GEND_MODE_STATE_T state = DD_GEND_SPENT_CHAMBER_FILL_STATE; + LEVEL_STATE_T spentChamberLevel = getLevelStatus( D46_LEVL ); + + // High level is met + if ( LEVEL_STATE_HIGH == spentChamberLevel ) + { + setModeGenDStateTransition( DD_GEND_DIALYSATE_BYPASS_STATE ); + isDialDeliveryInProgress.data = FALSE; + state = DD_GEND_DIALYSATE_BYPASS_STATE; + } + else + { + //Execute Spent chamber fill + execSpentChamberFillControl(); + } + + return state; + +} + /*********************************************************************//** * @brief * The requestDDGenDialyasteStop function handles an TD request to stop @@ -644,7 +678,7 @@ * @details \b Outputs: none * @return the target dialysate temperature for the treatment. *************************************************************************/ -static F32 getGenDialysateTargetTemperature( void ) +F32 getGenDialysateTargetTemperature( void ) { F32 temp = getF32OverrideValue( &targetHydChamberFluidTemp ); Index: firmware/App/Modes/ModeGenDialysate.h =================================================================== diff -u -rf6fb03f1e20395a61a5d5996f11f802ab8eacb2f -r977f03e20990ed5579160b9b927df1c0f2428101 --- firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision f6fb03f1e20395a61a5d5996f11f802ab8eacb2f) +++ firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 977f03e20990ed5579160b9b927df1c0f2428101) @@ -33,6 +33,7 @@ #define FRESH_DIAL_PUMP_INITIAL_RPM 2500 ///< Nominal RPM target for fresh dialysate pump to maintain required pressure. #define SPENT_DIAL_PUMP_INITIAL_RPM 2300 ///< Nominal RPM target for spent dialysate pump to maintain required pressure. +#define SPENT_DIAL_PUMP_FILL_RPM 1500 ///< Nominal RPM target for spent chamber fill operations. /// Generate dialysate mode data structure typedef struct @@ -61,6 +62,8 @@ void setTreatmentParamUpdate( void ); // To indicate one or more treatment parameters updated void updateTreatmentSettings( void ); // Process the recent treatment parameters changes BOOL requestDDGenDialyasteStop( void ); // Stop generate dialysate +void calculateTargetDialysateTemp( void ); // Update target dialysate temmperature with Delta Temp +F32 getGenDialysateTargetTemperature( void ); // Get the target dialysate temperature BOOL testDDGenDialysateDataPublishIntervalOverride( MESSAGE_T *message ); // GenD Mode data publish interval override BOOL testDialDeliveryInProgressOverride( MESSAGE_T *message ); // To override the dialysate delivery in progress flag Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r4b09605126f35b80406e95d079f3822c51a3ba25 -r977f03e20990ed5579160b9b927df1c0f2428101 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 977f03e20990ed5579160b9b927df1c0f2428101) @@ -138,6 +138,7 @@ SW_FAULT_ID_PRE_GEND_WET_SELF_TEST_INVALID_EXEC_STATE = 107, SW_FAULT_ID_PRE_GEND_WET_SELF_TEST_INVALID_EXEC_STATE1 = 108, SW_FAULT_ID_UF_INVALID_EXEC_STATE = 109, + SW_FAULT_ID_SPENT_CHAMBER_FILL_INVALID_EXEC_STATE = 110, #ifdef __PUMPTEST__ // Assigning high value to separate from actual fault id from test fault ids. SW_FAULT_ID_PISTON_PUMP_EXEC_INVALID_STATE = 9000,