Index: firmware/App/Modes/BalancingChamber.c =================================================================== diff -u -rbf55b31e342873e3d6047b09749628f5fe275d8d -rda2f672aa60ddf3a2ad40068313cfaac0b58bc5e --- firmware/App/Modes/BalancingChamber.c (.../BalancingChamber.c) (revision bf55b31e342873e3d6047b09749628f5fe275d8d) +++ firmware/App/Modes/BalancingChamber.c (.../BalancingChamber.c) (revision da2f672aa60ddf3a2ad40068313cfaac0b58bc5e) @@ -35,14 +35,15 @@ #define BAL_CHAMBER_FILL_VOLUME_ML 30.0F ///< Balancing chamber fill/drain volume per batch operation. #define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. -#define TEST_ACID_VOLUME_ML 0.63F ///< Acid concentrate volume in ml. -#define TEST_BICARB_VOLUME_ML 1.07F ///< Bicarb concentrate volume in ml. +#define TEST_ACID_VOLUME_ML 0.67F ///< Acid concentrate volume in ml. +#define TEST_BICARB_VOLUME_ML 1.15F ///< Bicarb concentrate volume in ml. // ********** private data ********** static BAL_CHAMBER_EXEC_STATE_T balChamberExecState; ///< Current balancing chamber executive state. static OVERRIDE_F32_T balChamberSwitchingFreq; ///< Balancing chamber switching rate ( switches per min) based on the dialysate flow rate ( overrideable) static U32 balChamberSwitchingPeriod; ///< Periodic balancing chamber switching time in task interval count. +static U32 balChamberValveClosePeriod; ///< Close balancing chamber valves with the defined time prior switching state. static U32 currentBalChamberSwitchingCounter; ///< Counter (in task interval) to monitor the timing spent during balancing chamber fill/drain operation. static BOOL isBalChamberFillInProgress; ///< Flag indicating balancing chamber fill/drain is in progress. static BOOL isPressureStalbilizedDuringFill; ///< Flag indicating that the pressure is stablized due to fill complete. @@ -80,6 +81,7 @@ balChamberDataPublishInterval.ovInitData = 0; balChamberDataPublishInterval.override = OVERRIDE_RESET; balChamberSwitchingPeriod = 0; + balChamberValveClosePeriod = 0; isBalChamberFillInProgress = FALSE; currentBalChamberSwitchingCounter = 0; isPressureStalbilizedDuringFill = FALSE; @@ -118,6 +120,10 @@ // finish the balancing chamber fill 50 ms prior completing the regular cycle time. balChamberSwitchingPeriod -= 1; + + //Testing + balChamberValveClosePeriod = balChamberSwitchingPeriod; + balChamberValveClosePeriod -= 1; // Close valves prior 50 msecond for testing } /*********************************************************************//** @@ -392,14 +398,15 @@ // Check fresh and spent dialysate pressure back in range to indicate fill complete. //TODO : comment the pressure check - if ( 1 ) + //if ( 1 ) + if ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) //if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && // ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) { // stabilized pressure indicating fill is complete //TODO : due to pressure testing override, comment the code below for now - // isPressureStalbilizedDuringFill = TRUE; - isPressureStalbilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = TRUE; + // isPressureStalbilizedDuringFill = FALSE; } // Swithcing time met or pressure in range, close valves @@ -494,14 +501,15 @@ // Check fresh and spent dialysate pressure back in range to indicate fill complete. //TODO : comment the pressure check - if ( 1 ) + //if ( 1 ) + if ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) //if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && // ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) { // stabilized pressure indicating fill is complete //TODO : due to pressure testing override, comment the code below for now - //isPressureStalbilizedDuringFill = TRUE; - isPressureStalbilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = TRUE; + //isPressureStalbilizedDuringFill = FALSE; } // Check switching cycle time or pressure check for valve closure