Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r48c4d25d6918813d93165fe4e7fee3bf0c247b7c -r0c0260299f210c9d80e684b1e0605b799880007b --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 48c4d25d6918813d93165fe4e7fee3bf0c247b7c) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 0c0260299f210c9d80e684b1e0605b799880007b) @@ -51,6 +51,7 @@ #define SPENT_DIFF_COUNT_ZERO 0 ///< Zero count difference for spent side fill comparing target count #define D48_SPEED_ADJUST_FACTOR 0.5F ///< D48 speed adjustment factor ( 50% of speed adjustment = 0.5) #define D48_SPEED_RANGE_LIMIT 0.25F ///< D48 speed adjustment range check limit ( D48 speed can vary +/-25% of initial calculated speed) +#define BICARB_CHAMBER_PERIODIC_FILL_TIME ( 1 * SEC_PER_MIN * ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ) ///< Periodic bicarb chamber fill request 60 sec x 20 = 1200 #define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 1.5 ///< Balancing Chamber fill timeout factor (150% of observed fill count) /// Payload record structure for balancing chamber switch only request @@ -89,8 +90,6 @@ //TODO: remove later once level sensor working static U32 bicarbChamberPeriodicFillCounter; ///< Counter for checking the timeout for drybicart chamber fill request. -static F32 prevSpentDialPressure; ///< Previous spent side dialysate pressure -static F32 lastPrevSpentDialPressure; ///< Last previous spent side dialysate pressure static U32 currentBalChamberFillCounter; ///< Counter (in task interval) to monitor the timing spent for the spent side fill operation. static U32 balChamberFillTimeoutCount; ///< Timeout count (in task interval) to detect BC fill timeout. static S32 diffSpentFillCompleteCount; ///< Difference between spent target fill to actual fill count @@ -158,8 +157,6 @@ //TODO:remove once level sensor working bicarbChamberPeriodicFillCounter = 0; - prevSpentDialPressure = 0.0F; - lastPrevSpentDialPressure = 0.0F; currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; diffSpentFillCompleteCount = 0; @@ -235,6 +232,23 @@ currentBalChamberSwitchingCounter += 1; currentBalChamberFillCounter += 1; + if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == TRUE ) + { + //Increment counter for dry bicarb chamber fill + bicarbChamberPeriodicFillCounter += 1; + // Fill bicarb chamber once every 60secs. + if ( bicarbChamberPeriodicFillCounter >= BICARB_CHAMBER_PERIODIC_FILL_TIME ) + { + if ( FALSE == setBicarbChamberFillRequested() ) + { + // TODO + //drybicart state machines are combined and so this is not an issue in future + //set alarm ? + } + bicarbChamberPeriodicFillCounter = 0; + } + } + // execute current balancing chamber exec state switch ( balChamberExecState ) { @@ -493,7 +507,7 @@ setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); } - // Check fresh and spent dialysate pressure in range or BC switch only flag set + // Check fresh dialysate pressure in range or BC switch only flag set or BC pressure alarms are disabled if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) {