Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rfd897db8177752330ad08d877e0a13620513dbdc -rde7ed4edf09692eb9b461b5fb9f73eb5f0a47bb6 --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision fd897db8177752330ad08d877e0a13620513dbdc) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision de7ed4edf09692eb9b461b5fb9f73eb5f0a47bb6) @@ -45,14 +45,18 @@ #define DRY_BICART_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. // Dry Bicart Fill -#define DRY_BICART_FILL_DURATION_MIN_MS ( 2 * MS_PER_SECOND ) ///< Minimum fill duration to be met to end the fill cycle. +#define DRY_BICART_FILL_PERSISTANCE_DURATION_MS 200 ///< Fill persistence duration to overcome the pressure over shoot for beta 1.9 and beta 2.0. +#define DRY_BICART_FILL_DURATION_MIN_MS ( 2 * MS_PER_SECOND + \ + DRY_BICART_FILL_PERSISTANCE_DURATION_MS ) ///< Minimum fill duration to be met to end the fill cycle. #define DRY_BICART_FILL_COMPLETE_TIME_MS ( 1 * MS_PER_SECOND ) ///< Wait time to reset the request flag after fill complete #define DRY_BICART_FILL_DURATION_DIFF_MS 750 ///< Fill duration difference between last and current fill cycle. -#define PRESSURE_OFFSET 2 ///< Dry bicart pressure offset + +#define PRESSURE_OFFSET 2 ///< Dry bicart pressure offset. #define DRY_BICART_FILL_COMPLETE_PRESSURE ( 10.0F + PRESSURE_OFFSET ) ///< Maximum pressure reached to indicate the dry bicart fill being completed. -#define DRY_BICART_FILL_INITIATE_PRESSURE 3.0F ///< Minimum pressure required to initiate the dry bicart fill process. +#define DRY_BICART_FILL_INITIATE_PRESSURE 1.5F ///< Minimum pressure required to initiate the dry bicart fill process. #define DRY_BICART_FILL_COMPLETE_SUPPLY_PRESSURE 6.0F ///< Maximum pressure allowed at bicart fill during supply process/state #define DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE 3.0F ///< Minimum pressure required to initiate the dry bicart fill during supply process/state +#define MAX_DRY_BICART_FILL_COMPLETE_PRESSURE 15 #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. @@ -1174,7 +1178,7 @@ //if(FP_MODE_GENP == getCurrentFPOperationMode()) { // TODO: pre gen should start the D12 pump and D14 valve - //setValveState( D14_VALV, VALVE_STATE_OPEN ); + setValveState( D14_VALV, VALVE_STATE_OPEN ); setDialysatePumpTargetRPM( D12_PUMP, FRESH_DIAL_PUMP_INITIAL_RPM_B1_9_B2_0, TRUE ); state = DRY_BICART_FILL_WATER_START_STATE; @@ -1230,12 +1234,22 @@ // Close dry bicart inlet water if bicart is filled with water if ( d66Pressure >= DRY_BICART_FILL_COMPLETE_PRESSURE ) { - setValveState( D65_VALV, VALVE_STATE_CLOSED ); - lastFillDurationInMS = currentFillDurationInMS; - currentFillDurationInMS = calcTimeSince( dryBiCartFillStartTime ); - //Increment number of fill cycle - biCartFillCycleCounter++; - state = DRY_BICART_DEGAS_START_STATE; + // to check the the maximum cart pressure during persistence on D66 + if ( d66Pressure >= MAX_DRY_BICART_FILL_COMPLETE_PRESSURE ) + { + setValveState( D65_VALV, VALVE_STATE_CLOSED ); + } + // 200 ms persistence on D66 pressure + if ( TRUE == didTimeout( dryBiCartFillStartTime, DRY_BICART_FILL_PERSISTANCE_DURATION_MS ) ) + { + + setValveState( D65_VALV, VALVE_STATE_CLOSED ); + lastFillDurationInMS = currentFillDurationInMS; + currentFillDurationInMS = calcTimeSince( dryBiCartFillStartTime ); + //Increment number of fill cycle + biCartFillCycleCounter++; + state = DRY_BICART_DEGAS_START_STATE; + } } //TODO:Handle timeout alarm for opening D65 valve too long @@ -1549,6 +1563,7 @@ setValveState( D80_VALV, VALVE_STATE_CLOSED ); dryBiCarbSypplyVentStartTime = getMSTimerCount(); + setValveState( D64_VALV, VALVE_STATE_CLOSED ); state = BICARB_SUPPLY_VENT_START_STATE; } /*else if ( d66Pressure <= getDryBicartLowerCartPressure() )