Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r557f409455dde035899c9f89a8b93f57e8eb7f2b -ref46e2aa7eba74dabd99bfcd9e6b38b8ce77820c --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 557f409455dde035899c9f89a8b93f57e8eb7f2b) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision ef46e2aa7eba74dabd99bfcd9e6b38b8ce77820c) @@ -414,7 +414,27 @@ /*********************************************************************//** * @brief - * The isEmptyBottle function returns the boolean flag that indicates + * The isBadFill function returns the boolean flag that indicates + * whether the bad fill is detected at the end of the fill mode. + * @details Inputs: none + * @details Outputs: none + * @return TRUE if bad fill, otherwise FALSE + *************************************************************************/ +BOOL isBadFill( void ) +{ + BOOL badFillFlag = FALSE; + + if ( TRUE == isAvgConductivityOutOfRange() ) + { + badFillFlag = TRUE; + } + + return badFillFlag; +} + +/*********************************************************************//** + * @brief + * The isEmptyAcidBottle function returns the boolean flag that indicates * whether the acid bottle is empty. * @details Inputs: none * @details Outputs: none @@ -427,7 +447,7 @@ /*********************************************************************//** * @brief - * The isEmptyBottle function returns the boolean flag that indicates + * The isEmptyBicarbBottle function returns the boolean flag that indicates * whether the bicarb bottle is empty. * @details Inputs: none * @details Outputs: none @@ -779,7 +799,7 @@ setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); //activateAlarmNoData( ALARM_ID_DG_ACID_BOTTLE_LOW_VOLUME ); // trigger empty acid bottle alarm at the end of drain mode and set both bottles need prime fillStatus.isThisFirstFill = TRUE; // empty bottles need replaced, set isThisFirstFill to FALSE so that prime, flush, acid & bicarb test are needed - fillStatus.fillEmtyAcidBottleDetected = TRUE; // set this variable to FALSE when user presses OK on the alarm to confirm bottle has been replaced and resume + fillStatus.fillEmtyAcidBottleDetected = TRUE; // set this variable to FALSE when user presses OK on the alarm to confirm bottle has been replaced and resume //requestNewOperationMode( DG_MODE_GENE ); } @@ -817,22 +837,23 @@ #ifndef DISABLE_DIALYSATE_CHECK // SRSDG 400 if ( TRUE == isValueWithinPercentRange( avgBicardConductivity, BICARB_NORMAL_CONDUCTIVITY, FIVE_PERCENT_FACTOR ) ) { - fillStatus.fillAvgConductivityOutOfRange = TRUE; // signal idle mode to handle bad fill + fillStatus.fillAvgConductivityOutOfRange = TRUE; // flag to signal idle mode to handle bad fill fillStatus.isThisFirstFill = TRUE; setBottlesNeedPrimeFlag( TRUE ); - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_CONDUCTIVITY_FAULT, avgBicardConductivity, BICARB_NORMAL_CONDUCTIVITY ); - requestNewOperationMode( DG_MODE_GENE ); // leave fill mode if bad fill is detected due to avg bicarb is out of range + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_REPLACE_CONCENTRATE_BOTTLES, avgBicardConductivity, BICARB_NORMAL_CONDUCTIVITY ); // trigger replace bottles alarm #1 + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT, avgBicardConductivity, BICARB_NORMAL_CONDUCTIVITY ); // immediately trigger wait for dialysate alarm #2 + requestNewOperationMode( DG_MODE_GENE ); // leave fill mode and go to idle } if ( TRUE == isValueWithinPercentRange( avgAcidConductivity, ACID_NORMAL_CONDUCTIVITY, FIVE_PERCENT_FACTOR ) ) { - fillStatus.fillAvgConductivityOutOfRange = TRUE; // signal idle mode to handle bad fill + fillStatus.fillAvgConductivityOutOfRange = TRUE; // flag to signal idle mode to handle bad fill fillStatus.isThisFirstFill = TRUE; setBottlesNeedPrimeFlag( TRUE ); - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_CONDUCTIVITY_FAULT, avgAcidConductivity, ACID_NORMAL_CONDUCTIVITY ); - requestNewOperationMode( DG_MODE_GENE ); // leave fill mode if bad fill is detected due to avg acid out of range + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_REPLACE_CONCENTRATE_BOTTLES, avgAcidConductivity, ACID_NORMAL_CONDUCTIVITY ); // trigger replace bottles alarm #1 then + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT, avgAcidConductivity, ACID_NORMAL_CONDUCTIVITY ); // immediately trigger wait for dialysate alarm #2 + requestNewOperationMode( DG_MODE_GENE ); // leave fill mode and go to idle } - #endif // Done with this fill. Calculate the average fill flow rate and average temperature // Reset the variables for the next fill