Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r1507b3d6f58c87107d96a9da744423d06a70057c -rf2fc3885d55b51a6201c8f4f38e57cf7bcf3ee46 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 1507b3d6f58c87107d96a9da744423d06a70057c) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision f2fc3885d55b51a6201c8f4f38e57cf7bcf3ee46) @@ -189,7 +189,8 @@ static F64 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average. static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer. -static U32 dipCurrErrorDurationCtr = 0; ///< Used for tracking persistence of dip current errors. +static U32 dipCurrErrorDurationCtr = 0; ///< Used for tracking persistence of dip current errors. +static HD_PUMPS_CAL_RECORD_T dialInPumpCalRecord; ///< Dialysate inlet calibration record. // ********** private function prototypes ********** @@ -398,6 +399,21 @@ return isDialInPumpOn; } +/*********************************************************************//** + * @brief + * The isDialInPumpRampComplete function returns whether the dialysate inlet pump has + * completed its ramp up and entered control state (closed or open loop). + * @details Inputs: dialInPumpState + * @details Outputs: none + * @return TRUE if pump is in control state, FALSE if not + *************************************************************************/ +BOOL isDialInPumpRampComplete( void ) +{ + BOOL result = ( DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE == dialInPumpState ? TRUE : FALSE ); + + return result; +} + /*********************************************************************//** * @brief * The execDialInFlowMonitor function executes the dialIn flow monitor. @@ -417,18 +433,22 @@ { dipFlow = getDGDialysateFlowRateLMin() * (F64)ML_PER_LITER; // convert rate to mL/min filterDialInFlowReadings( dipFlow ); // process the fresh dialysate flow data - dialysateFlowDataFreshStatusCounter = 0; // reset counter + dialysateFlowDataFreshStatusCounter = 0; } else { // Alarm if not receiving new dialysate flow readings in timely manner - if ( ++dialysateFlowDataFreshStatusCounter > DIP_DIALYSATE_FLOW_DATA_ALARM_THRESHOLD ) + if ( TRUE == isDGCommunicating() ) { - filterDialInFlowReadings( 0.0 ); - if ( TRUE == isDGCommunicating() ) + if ( ++dialysateFlowDataFreshStatusCounter > DIP_DIALYSATE_FLOW_DATA_ALARM_THRESHOLD ) { + filterDialInFlowReadings( 0.0 ); activateAlarmNoData( ALARM_ID_HD_DIALYSATE_FLOW_DATA_NOT_RECEIVE ); } } + else + { + dialysateFlowDataFreshStatusCounter = 0; + } } // Get latest pump speed and current from motor controller @@ -984,7 +1004,9 @@ if ( lastDialInPumpDirectionCount != dirErrorCnt ) { lastDialInPumpDirectionCount = dirErrorCnt; +#ifndef DISABLE_PUMP_DIRECTION_CHECKS SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_INLET_PUMP ) +#endif } #endif @@ -1215,13 +1237,25 @@ * The execDialInFlowTest function executes the state machine for the * DialInFlow self-test. * @details Inputs: none - * @details Outputs: none + * @details Outputs: dialInPumpCalRecord * @return the current state of the DialInFlow self-test. *************************************************************************/ SELF_TEST_STATUS_T execDialInFlowTest( void ) { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; + BOOL calStatus = getNVRecord2Driver( GET_CAL_PUMPS, (U08*)&dialInPumpCalRecord, sizeof( HD_PUMPS_CAL_RECORD_T ), + NUM_OF_CAL_DATA_HD_PUMPS, ALARM_ID_NO_ALARM ); + + if ( TRUE == calStatus ) + { + result = SELF_TEST_STATUS_PASSED; + } + else + { + result = SELF_TEST_STATUS_FAILED; + } + return result; }