Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rfc26356f5aae3e51f6267e41da0d74e76a9d5b6d -rcd1161514dbaff9e5b222931fff99618e39fd7ec --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision fc26356f5aae3e51f6267e41da0d74e76a9d5b6d) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision cd1161514dbaff9e5b222931fff99618e39fd7ec) @@ -24,6 +24,7 @@ #include "DryBiCart.h" #include "Level.h" #include "Messaging.h" +#include "MixingControl.h" #include "ModeGenDialysate.h" #include "OperationModes.h" #include "PIControllers.h" @@ -151,7 +152,7 @@ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberStartState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberCartridgeFillWaterStartState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberCartridgeFillWaterEndState( void ); -static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChambeSupplyStart( void ); +static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyStart( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberPressureCheckState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentStartState(void); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentEndState(void); @@ -163,7 +164,6 @@ static F32 getDryBicartLowerCartPressure( void ); static F32 getDryBicartUpperCartPressure( void ); -static U32 getDryBicartMixControlInterval( void ); // publish the status static void publishDryBicartData( void ); @@ -260,19 +260,20 @@ * bicarbonate chamber fill and bicarbonate cartridge drain related state machines one at time * @details \b Inputs: dryBicartStartRequest * @details \b Outputs: none + * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong dry bicart state machine is + * invoked. * @return none. *************************************************************************/ void execDryBicart( void ) { - //( TRUE == getBicarbChamberFillRequested() ) - //supply dryBicartStartRequest = DRY_BICART_SUPPLY ; - //( TRUE == getBicartFillRequested() ) - //fill dryBicartStartRequest = DRY_BICART_INITIAL_FILL; - //( TRUE == getBicartDrainRequested() ) - //drain dryBicartStartRequest = DRY_BICART_DRAIN; - //else idle dryBicartStartRequest = DRY_BICART_IDLE; - updateDrybicartOperation(); + //DRY_BICART_SUPPLY ; + //DRY_BICART_INITIAL_FILL; + //DRY_BICART_DRAIN; + //default DRY_BICART_IDLE; + // the below function select any one of the above request + //updateDrybicartOperation(); + if( getCurrentBalancingChamberExecState() > BAL_CHAMBER_STATE_IDLE ) { // closed loop bicarb and acid mixing controller @@ -286,6 +287,12 @@ { case DRY_BICART_IDLE: // run as idle state + //DRY_BICART_SUPPLY ; + //DRY_BICART_INITIAL_FILL; + //DRY_BICART_DRAIN; + //default DRY_BICART_IDLE; + //the below function select any one of the above request + updateDrybicartOperation(); break; case DRY_BICART_INITIAL_FILL: @@ -396,7 +403,7 @@ break; case BICARB_CHAMBER_FILL_STATE: - bicarbChamberFillExecState = handleBicarbChamberFillState(); + bicarbChamberFillExecState = handleBicarbChamberSupplyStart(); break; case BICARB_CHAMBER_PRESSURE_CHECK_STATE: @@ -919,6 +926,7 @@ hydChamberWaterInletControl(); state = DRY_BICART_START_STATE; + dryBicartStartRequest = DRY_BICART_IDLE; } return state; @@ -1030,12 +1038,12 @@ /*********************************************************************//** * @brief - * The handleBicarbChambeSupplyStart function open the bicarb inlet valve (D80). + * The handleBicarbChamberSupplyStart function open the bicarb inlet valve (D80). * @details \b Inputs: none * @details \b Outputs: valve states, dryBiCarbSupplyStartTime * @return the next bicarb chamber fill state. *************************************************************************/ -static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChambeSupplyStart( void ) +static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyStart( void ) { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CHAMBER_PRESSURE_CHECK_STATE; @@ -1153,7 +1161,7 @@ setValveState( D64_VALV, VALVE_STATE_OPEN ); // D66 pressure drops to below 1.5 PSI or time out - if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE ) ) + if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { // start the persistence timer once d66 reaches if it drops below 1.5 if ( 0 == dryBiCartPersistenceStartTime ) @@ -1202,6 +1210,8 @@ state = BICARB_CHAMBER_START_STATE; + dryBicartStartRequest = DRY_BICART_IDLE; + return state; } @@ -1379,6 +1389,7 @@ // for this request override also cleared dryBiCartDrainRequested.ovData = FALSE; state = DRY_BICART_DRAIN_START_STATE; + dryBicartStartRequest = DRY_BICART_IDLE; return state; }