Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -r40d8f8f053e42c5ba32b65ca210238a25b15ec80 -rf8a9855f80d7f8f10a4e2468d18ee825ef8a5e72 --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision 40d8f8f053e42c5ba32b65ca210238a25b15ec80) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision f8a9855f80d7f8f10a4e2468d18ee825ef8a5e72) @@ -50,6 +50,9 @@ #define DRY_BICART_FILL_DURATION_DIFF_MS 750 ///< Fill duration difference between last and current fill cycle. #define DRY_BICART_FILL_COMPLETE_PRESSURE 12.0F ///< Maximum pressure reached to indicate the dry bicart fill being completed. #define DRY_BICART_FILL_INITIATE_PRESSURE 7.5F ///< Minimum pressure required to initiate the dry bicart fill process. +#define DRY_BICART_FILL_COMPLETE_SUPPLY_PRESSURE 7.0F ///< Maximum pressure reached to indicate the dry bicart fill being completed. +#define DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE 5.0F ///< Minimum pressure required to initiate the dry bicart fill process. + #define DRY_BICART_DEFAULT_MAX_FILL_CYCLE_CNT 10 ///< Default max fill cycle allowed for dry bicart fill/mix with water. #define DRY_BICART_MAX_FILL_CYCLE_CNT 30 ///< Max fill cycle allowed (by override) for dry bicart fill/mix with water. // Dry Bicart Fill Vent @@ -58,9 +61,9 @@ #define DRY_BICART_FILL_VENT_COMPLETE_PRESSURE 1.5F ///< Pressure reached to indicate the dry bicart venting being completed. // Bicarb chamber fill/Supply -#define DRY_BICART_SUPPLY_VALVE_D80_OPEN_TIME_MS ( ( 1 * MS_PER_SECOND ) / 2 ) ///< Max time allowed for supply (opening D80 valve) during bicarb chamber (F) fill. +#define DRY_BICART_SUPPLY_VALVE_D80_OPEN_TIME_MS ( 3 * MS_PER_SECOND ) ///< Max time allowed for supply (opening D80 valve) during bicarb chamber (F) fill. #define DRY_BICART_SUPPLY_VENT_TIME_MS ( 1 * MS_PER_SECOND ) ///< Wait time to vent dry bicart gas before actuating Bicarb chamber(F) venting. -#define DRY_BICART_SUPPLY_VENT_MAX_TIME_MS ( 3 * MS_PER_SECOND ) ///< Max time to vent both dry bicart and Chamber F. +#define DRY_BICART_SUPPLY_VENT_MAX_TIME_MS ( 1.2 * MS_PER_SECOND ) ///< Max time to vent both dry bicart and Chamber F. // Dry Bicart Drain #define LARGE_DRY_BICART_MAX_DRAIN_TIME_MS ( 8 * SEC_PER_MIN * MS_PER_SECOND ) ///< Max drain time for large dry bicart in ms. @@ -85,7 +88,7 @@ #define ACID_VOL_CONTROL_P_COEFFICIENT 0.00000997 ///< Propotional gain (kp) #define ACID_VOL_CONTROL_I_COEFFICIENT 0.00003988 ///< Integral gain. (ki) -#define MIN_ACID_VOLUME_MLPM 0.653333333 // 0.2 ///< Minimum target acid volume in mL/min. +#define MIN_ACID_VOLUME_MLPM 0.653333333 ///< Minimum target acid volume in mL/min. #define MAX_ACID_VOLUME_MLPM 0.70 ///< Maximum target acid volume in mL/min. @@ -490,6 +493,8 @@ *************************************************************************/ U32 execDryBicartFillMode( void ) { + hydChamberWaterInletControl(); + // execute drybicart fill state machine switch ( dryBiCartFillExecState ) { @@ -541,6 +546,7 @@ *************************************************************************/ U32 execBicarbChamberFillMode( void ) { + // TODO in pregen mode call hydChamberWaterInletControl(); // execute bicarb chamber fill state machine switch ( bicarbChamberFillExecState ) { @@ -1496,7 +1502,7 @@ // TODO: Enable the below code once level sensor is working //if ( LEVEL_STATE_LOW == bicarbChamberLevel ) { - if ( getBalancingChamberFillinProgressStatus() == FALSE ) + // if ( getBalancingChamberFillinProgressStatus() == FALSE ) { // Open the Bicarb chamber inlet valve setValveState( D80_VALV, VALVE_STATE_OPEN ); @@ -1533,11 +1539,15 @@ state = BICARB_CHAMBER_PRESSURE_CHECK_STATE; } // Open water inlet valve to fill the bicart - else if ( d66Pressure <= DRY_BICART_FILL_INITIATE_PRESSURE ) + else if ( d66Pressure <= DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); state = BICARB_CHAMBER_PRESSURE_CHECK_STATE; } + else + { + state = BICARB_CHAMBER_PRESSURE_CHECK_STATE; + } return state; } @@ -1566,9 +1576,12 @@ dryBiCarbSypplyVentStartTime = getMSTimerCount(); state = BICARB_SUPPLY_VENT_START_STATE; } - + else if ( d66Pressure <= DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE ) + { + setValveState( D65_VALV, VALVE_STATE_OPEN ); + } // Close water inlet valve as fill is complete. - if ( d66Pressure >= DRY_BICART_FILL_COMPLETE_PRESSURE ) + else if ( d66Pressure >= DRY_BICART_FILL_COMPLETE_SUPPLY_PRESSURE ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); } @@ -1596,7 +1609,8 @@ if ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_SUPPLY_VENT_MAX_TIME_MS ) ) { - //Vent chamber F after 3 sec + setValveState( D85_VALV, VALVE_STATE_CLOSED ); + //Vent chamber F after 200 ms setValveState( D64_VALV, VALVE_STATE_OPEN ); dryBiCarbSypplyVentStartTime = getMSTimerCount(); state = BICARB_SUPPLY_VENT_END_STATE; @@ -1617,8 +1631,8 @@ { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_SUPPLY_VENT_END_STATE; - // close bicart vent and chamber f vent after 3 sec - if ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_SUPPLY_VENT_MAX_TIME_MS ) ) + // close bicart vent and chamber f vent after 2 sec + if ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); setValveState( D64_VALV, VALVE_STATE_CLOSED);