Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r977f03e20990ed5579160b9b927df1c0f2428101 -rcaa15db89a49c98671f0a87dc2242d0fc7f683b7 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 977f03e20990ed5579160b9b927df1c0f2428101) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision caa15db89a49c98671f0a87dc2242d0fc7f683b7) @@ -418,13 +418,9 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure in range or BC switch only flag set -#ifndef __BC_PRESSURE_ALARM__ - if ( 1 ) -#else 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 ) ) || - ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) -#endif + ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) || + ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) ) ) { //Valve control for state 1 fill valveControlForBCState1FillStart(); @@ -446,10 +442,11 @@ } else { -#ifdef __BC_PRESSURE_ALARM__ - //Alarm when pressure is not in range - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -#endif + if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) + { + //Alarm when pressure is not in range + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } } return state; @@ -521,20 +518,23 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. -#ifdef __BC_PRESSURE_ALARM__ - 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 ) ) ) + if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + 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 - isPressureStalbilizedDuringFill = TRUE; - isBalChamberFillInProgress = FALSE; + if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + { + // stabilized pressure indicating fill is complete + isPressureStalbilizedDuringFill = TRUE; + isBalChamberFillInProgress = FALSE; + } } } -#else + else + { isPressureStalbilizedDuringFill = FALSE; -#endif + } // Switching time met or pressure in range, close valves if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || @@ -574,26 +574,29 @@ if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { -#ifdef __BC_PRESSURE_ALARM__ - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - // When fill initiated, pressure is not dropped to the expected range, possible valve failures. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + { + // When fill initiated, pressure is not dropped to the expected range, possible valve failures. + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } + else if ( TRUE != isPressureStalbilizedDuringFill ) + { + // Alarm when switching time expired, but still pressure not in range which indicates fill is not yet completed. + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } + else + { + // Move to next state when pressure is in range. + state = BAL_CHAMBER_STATE2_FILL_START; + } } - else if ( TRUE != isPressureStalbilizedDuringFill ) - { - // Alarm when switching time expired, but still pressure not in range which indicates fill is not yet completed. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - } else { - // Move to next state when pressure is in range. + // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE2_FILL_START; } -#else - // Allow to proceed next state even though pressure is not stabilized. - state = BAL_CHAMBER_STATE2_FILL_START; -#endif } else { @@ -629,13 +632,9 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure in range -#ifndef __BC_PRESSURE_ALARM__ - if ( 1 ) -#else 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 ) ) || - ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) -#endif + ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) ) ) { // Valve control for state 2 fill valveControlForBCState2FillStart(); @@ -657,10 +656,11 @@ } else { -#ifdef __BC_PRESSURE_ALARM__ - //Alarm when pressure is not in range - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -#endif + if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) + { + //Alarm when pressure is not in range + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } } return state; } @@ -681,20 +681,23 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. -#ifdef __BC_PRESSURE_ALARM__ - 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 ) ) ) + if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + 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 - isPressureStalbilizedDuringFill = TRUE; - isBalChamberFillInProgress = FALSE; + if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + { + // stabilized pressure indicating fill is complete + isPressureStalbilizedDuringFill = TRUE; + isBalChamberFillInProgress = FALSE; + } } } -#else + else + { isPressureStalbilizedDuringFill = FALSE; -#endif + } // Check switching cycle time or pressure check for valve closure if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || @@ -735,32 +738,35 @@ // Pressure alarm check if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { -#ifdef __BC_PRESSURE_ALARM__ - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + if ( getTestConfigStatus( TEST_CONFIG_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - // When fill initiated, pressure is not dropped to the expected range, possible valve failures. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) + { + // When fill initiated, pressure is not dropped to the expected range, possible valve failures. + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } + else if ( TRUE != isPressureStalbilizedDuringFill ) + { + // Alarm when switching time expired, but still pressure not in range which indicates fill is not completed. + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + } + else + { + // Move to next state when pressure is in range. + state = BAL_CHAMBER_STATE1_FILL_START; + + // Trigger pressure drop alarm after first cycle of balancing chamber switching complete + if ( FALSE == isFirstCycleBCSwitchingCompleted ) + { + isFirstCycleBCSwitchingCompleted = TRUE; + } + } } - else if ( TRUE != isPressureStalbilizedDuringFill ) - { - // Alarm when switching time expired, but still pressure not in range which indicates fill is not completed. - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); - } else { - // Move to next state when pressure is in range. + // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE1_FILL_START; - - // Trigger pressure drop alarm after first cycle of balancing chamber switching complete - if ( FALSE == isFirstCycleBCSwitchingCompleted ) - { - isFirstCycleBCSwitchingCompleted = TRUE; - } } -#else - // Allow to proceed next state even though pressure is not stabilized. - state = BAL_CHAMBER_STATE1_FILL_START; -#endif } else { Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r846d04b392ffb11d26e5f8376734e1d5335b140e -rcaa15db89a49c98671f0a87dc2242d0fc7f683b7 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 846d04b392ffb11d26e5f8376734e1d5335b140e) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision caa15db89a49c98671f0a87dc2242d0fc7f683b7) @@ -37,7 +37,8 @@ #define CONCENTRATE_PUMP_RAMP_SPEED_INCREMENT 10.0F ///< Speed increase (mL/min) when controlling concentrate pump to target step speed. #define CONCENTRATE_PUMP_MIN_SPEED 3.0F ///< Minimum speed for concentrate pump in mL per min. -#define CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_ON_PCT 0.02F ///< Concentrate pump speed out of range tolerance when on in percentage. +#define CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_ON_PCT 0.01F ///< Concentrate pump speed out of range tolerance when on in percentage. +#define CONCENTRATE_PUMP_CLEANING_SPD_OUT_OF_RANGE_TOL_PCT 0.05F ///< Concentrate pump cleaning mode speed out of range tolerance when on in percentage. #define CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_SLOW_MLPM 1.0F ///< Concentrate pump speed out of range tolerance when slow in mL/min. #define CONCENTRATE_PUMP_LOW_SPEED_THRESHOLD_MLPM 10.0F ///< Concentrate pump low speed threshold in mL/min. #define CONCENTRATE_PUMP_ZERO_FLOW_RATE 0xFFFF ///< Pulse width value when zero flow rate or pump is off. @@ -135,6 +136,7 @@ static U32 concentratePumpMonitorTimerCounter; ///< Timer counter to perform monitor on concentrate pump. static BOOL acidConcentratePumpParkPersistenceClear; ///< Boolean acid park persistence clearing. static BOOL bicarbConcentratePumpParkPersistenceClear; ///< Boolean for bicarb park persistence clearing. +static BOOL ufPumpParkPersistenceClear; ///< Boolean for UF pump park persistence clearing. /// Concentrate pump data publish interval. static OVERRIDE_U32_T concentratePumpDataPublishInterval = { CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL, CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL, 0, 0 }; @@ -181,6 +183,7 @@ concentratePumpMonitorTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; acidConcentratePumpParkPersistenceClear = FALSE; bicarbConcentratePumpParkPersistenceClear = FALSE; + ufPumpParkPersistenceClear = FALSE; for ( pumpId = CONCENTRATEPUMPS_FIRST; pumpId < NUM_OF_CONCENTRATE_PUMPS; pumpId++ ) { @@ -224,7 +227,7 @@ initPersistentAlarm( ALARM_ID_DD_D11_PUMP_SPEED_CONTROL_ERROR, 0, CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR, 0, CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE_TIMEOUT_MS ); - //TODO: UF pump park bits to be defined in HDD and then will handle UF pump alarm later + initPersistentAlarm( ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR, 0, CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DD_CONC_PUMP_HALL_SENSOR_OUT_OF_RANGE, CONCENTRATE_PUMP_HALL_SENSORS_OUT_OF_RANGE_TIME_MS, CONCENTRATE_PUMP_HALL_SENSORS_OUT_OF_RANGE_TIME_MS ); initPersistentAlarm( ALARM_ID_DD_CONCENTRATE_PUMP_FAULT, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD ); } @@ -243,6 +246,9 @@ U08 fpgaConcPumpsFault = getFPGAConcentratePumpsFault(); BOOL isConcPumpFault = ( fpgaConcPumpsFault > 0 ? TRUE : FALSE ); + //Update UF pump speed fault + fpgaConcPumpsFault |= getFPGAUFPumpFault(); + // Check if a new calibration is available // if ( TRUE == isNewCalibrationRecordAvailable() ) // { @@ -267,6 +273,7 @@ //Monitor Pump Speed monitorPumpSpeed( D11_PUMP, ALARM_ID_DD_D11_PUMP_SPEED_CONTROL_ERROR ); monitorPumpSpeed( D10_PUMP, ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR ); + monitorPumpSpeed( D76_PUMP, ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR ); checkPersistentAlarm( ALARM_ID_DD_CONCENTRATE_PUMP_FAULT, isConcPumpFault, fpgaConcPumpsFault, CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD ); @@ -280,16 +287,17 @@ * and associated fault handling. * @details \b Inputs: Park status * @details \b Outputs: isConcPumpParkInProgress,acidConcentratePumpParkPersistenceClear - * bicarbConcentratePumpParkPersistenceClear + * bicarbConcentratePumpParkPersistenceClear,ufPumpParkPersistenceClear * @return none *************************************************************************/ static void monitorPumpParkStatus( void ) { parked[ D11_PUMP ].data = (U32)getFPGAD11PumpIsParked(); parked[ D10_PUMP ].data = (U32)getFPGAD10PumpIsParked(); + parked[ D76_PUMP ].data = (U32)getFPGAD76PumpIsParked(); parkFaulted[ D11_PUMP ].data = (U32)getFPGAD11PumpParkFault(); parkFaulted[ D10_PUMP ].data = (U32)getFPGAD10PumpParkFault(); - // TODO : Handle UF Pump Park alarms once HDD updated with the details. + parkFaulted[ D76_PUMP ].data = (U32)getFPGAD76PumpParkFault(); if ( ( TRUE == getConcPumpIsParked( D11_PUMP ) ) || ( TRUE == getConcPumpParkIsFaulted( D11_PUMP ) ) ) { @@ -300,6 +308,10 @@ { concentratePumps[ D10_PUMP ].isConcPumpParkInProgress = FALSE; } + if ( ( TRUE == getConcPumpIsParked( D76_PUMP ) ) || ( TRUE == getConcPumpParkIsFaulted( D76_PUMP ) ) ) + { + concentratePumps[ D76_PUMP ].isConcPumpParkInProgress = FALSE; + } // Don't monitor persistence for cp speed alarms if we are parked. if ( TRUE == acidConcentratePumpParkPersistenceClear ) @@ -327,6 +339,19 @@ resetPersistentAlarmTimer( ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR ); } } + + if ( TRUE == ufPumpParkPersistenceClear ) + { + // Clear flag and resume persistence checking once park bit is set. + if ( TRUE == getConcPumpIsParked( D76_PUMP ) ) + { + ufPumpParkPersistenceClear = FALSE; + } + else + { + resetPersistentAlarmTimer( ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR ); + } + } } /*********************************************************************//** @@ -399,7 +424,7 @@ * the concentrate pumps. * @details \b Inputs: none * @details \b Outputs: concentratePumps[],acidConcentratePumpParkPersistenceClear, - * bicarbConcentratePumpParkPersistenceClear + * bicarbConcentratePumpParkPersistenceClear, ufPumpParkPersistenceClear * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id * @return none @@ -411,6 +436,7 @@ concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = TRUE; acidConcentratePumpParkPersistenceClear = FALSE; bicarbConcentratePumpParkPersistenceClear = FALSE; + ufPumpParkPersistenceClear = FALSE; } else { @@ -874,8 +900,8 @@ } else { - //TODO: Need to evaluate park support in the new pump. setFPGAD76PumpParkCmd(); + ufPumpParkPersistenceClear = TRUE; } concentratePumps[ pumpId ].isConcPumpParkInProgress = TRUE; } @@ -937,6 +963,7 @@ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpRampToTargetSpeedState( CONCENTRATE_PUMPS_T pumpId ) { CONCENTRATE_PUMP_STATE_T state = CONCENTRATE_PUMP_RAMP_TO_TARGET_SPEED_STATE; + //U16 currentMeasuredRev = getConcPumpCurrentMeasuredRevolutionCount( pumpId ); if ( TRUE == stepConcentratePumpToTargetSpeed( pumpId ) ) { @@ -967,6 +994,7 @@ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpControlTargetSpeedState( CONCENTRATE_PUMPS_T pumpId ) { CONCENTRATE_PUMP_STATE_T state = CONCENTRATE_PUMP_CONTROL_TARGET_SPEED_STATE; + //U16 currentMeasuredRev = getConcPumpCurrentMeasuredRevolutionCount( pumpId ); F32 targetToCurreSpeedDiffMLPM = fabs( getPumpTargetSpeed( pumpId ) - concentratePumps[ pumpId ].currentPumpSpeed ); if ( ++concentratePumps[ pumpId ].controlTimerCounter >= CONCENTRATE_PUMP_CONTROL_INTERVAL ) @@ -1156,23 +1184,33 @@ * between requested and measured is not in range. * @details \b Alarm: ALARM_ID_DD_D10_PUMP_SPEED_CONTROL_ERROR when the speed difference * between requested and measured is not in range. + * @details \b Alarm: ALARM_ID_DD_D76_PUMP_SPEED_CONTROL_ERROR when the speed difference + * between requested and measured is not in range. * @param pumpId pump id to check the difference between requested and measured speed * @param alarm which the corresponding alarm of the concentrate pump * @return none *************************************************************************/ static void monitorPumpSpeed( CONCENTRATE_PUMPS_T pumpId, ALARM_ID_T alarm ) { - F32 cpTargetSpeed = concentratePumps[ pumpId ].currentPumpSpeed; - F32 cpError = fabs( fabs( getMeasuredPumpSpeedMLPM( pumpId ) ) - cpTargetSpeed ); - BOOL isCpSpeedOut = FALSE; - F32 tolerance = CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_SLOW_MLPM; + F32 cpTargetSpeed = fabs( concentratePumps[ pumpId ].currentPumpSpeed ); + F32 cpMeasSpeed = fabs( getMeasuredPumpSpeedMLPM( pumpId ) ); + F32 cpError = fabs( cpMeasSpeed - cpTargetSpeed ); + BOOL isCpSpeedOut = FALSE; + F32 tolerance = CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_SLOW_MLPM; + DD_OP_MODE_T opMode = getCurrentOperationMode(); if ( cpTargetSpeed > CONCENTRATE_PUMP_LOW_SPEED_THRESHOLD_MLPM ) { // Check if the pump is not in the off state and if it is not and greater than the minimum threshold, divide the error // to target speed. If the pump is off the target speed is 0 so the speed check is done differently + // The speed tolerance is looser in heat disinfect and flush than the rest of the modes that the concentrate pump are running. cpError = cpError / cpTargetSpeed; tolerance = CONCENTRATE_PUMP_SPD_OUT_OF_RANGE_TOL_WHEN_ON_PCT; + + if ( DD_MODE_HEAT == opMode ) + { + tolerance = CONCENTRATE_PUMP_CLEANING_SPD_OUT_OF_RANGE_TOL_PCT; + } } isCpSpeedOut = ( cpError > tolerance ? TRUE : FALSE ); Index: firmware/App/DDCommon.h =================================================================== diff -u -r846d04b392ffb11d26e5f8376734e1d5335b140e -rcaa15db89a49c98671f0a87dc2242d0fc7f683b7 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 846d04b392ffb11d26e5f8376734e1d5335b140e) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision caa15db89a49c98671f0a87dc2242d0fc7f683b7) @@ -25,7 +25,7 @@ #define DD_VERSION_MAJOR 0 #define DD_VERSION_MINOR 0 #define DD_VERSION_MICRO 0 -#define DD_VERSION_BUILD 11 +#define DD_VERSION_BUILD 21 // ********** development build switches ********** @@ -44,11 +44,8 @@ //Uncomment below once characterization/study completed //#define ENABLE_ALARM_2 - //Uncomment below to disable heaters debug message #define __HEATERS_DEBUG__ 1 - - #include #include #endif Index: firmware/App/Services/Messaging.c =================================================================== diff -u -rc51c9d66062c27c588006850550b412ea7dd5144 -rcaa15db89a49c98671f0a87dc2242d0fc7f683b7 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision c51c9d66062c27c588006850550b412ea7dd5144) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision caa15db89a49c98671f0a87dc2242d0fc7f683b7) @@ -34,14 +34,12 @@ #include "ModeStandby.h" #include "OperationModes.h" #include "PAL.h" -#ifdef __PUMPTEST__ -#include "PistonPumpControl.h" -#endif #include "Pressure.h" #include "SafetyShutdown.h" #include "SpentChamberFill.h" #include "SystemCommDD.h" #include "Temperature.h" +#include "TestSupport.h" #include "TDInterface.h" #include "Utilities.h" #include "Ultrafiltration.h" @@ -170,6 +168,9 @@ { MSG_ID_DD_PISTON_PUMP_START_STOP_OVERRIDE_REQUEST, &testDDPistonPumpStartStopOverride }, { MSG_ID_DD_PISTON_PUMP_FILL_AFTER_DISPENSE_OVERRIDE_REQUEST, &testDDPistonPumpFillAfterDispenseOverride }, #endif + { MSG_ID_DD_SET_TEST_CONFIGURATION, &testSetTestConfiguration }, + { MSG_ID_DD_GET_TEST_CONFIGURATION, &testGetTestConfiguration }, + { MSG_ID_DD_RESET_ALL_TEST_CONFIGURATIONS, &testResetAllTestConfigurations }, }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLER_LOOKUP) / sizeof(MSG_HANDLER_LOOKUP_T)) @@ -718,9 +719,90 @@ setSystemREG1_SYSECR( (0x2) << 14 ); // Reset processor } - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); + return result; +} +/*********************************************************************//** + * @brief + * The testSetTestConfiguration function handles a request to set a + * test configuration. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return TRUE if command accepted, FALSE if rejected + *************************************************************************/ +BOOL testSetTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( sizeof( TEST_CONFIG_PAYLOAD_T ) == message->hdr.payloadLen ) + { + TEST_CONFIG_PAYLOAD_T payload; + + // copy message payload to local variable + memcpy( (U08*)&payload, &message->payload[0], sizeof( TEST_CONFIG_PAYLOAD_T ) ); + + // Verify given test configuration is valid + if ( payload.config < NUM_OF_TEST_CONFIGS ) + { + result = TRUE; + if ( FALSE == payload.reset ) + { + setTestConfig( (TEST_CONFIG_T)payload.config ); + } + else + { + resetTestConfig( (TEST_CONFIG_T)payload.config ); + } + } + } + return result; } +/*********************************************************************//** + * @brief + * The testGetTestConfiguration function handles a request to get a + * test configuration. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL testGetTestConfiguration( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = sendTestConfigStatusToDialin(); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetTestConfiguration function handles a request to reset all + * test configurations. + * @details \b Inputs: none + * @details \b Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +BOOL testResetAllTestConfigurations( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = resetAllTestConfigs(); + } + + return result; +} + /**@}*/ Index: firmware/source/sys_main.c =================================================================== diff -u -r229341f9eb23fec730cdf9b1f8f3960de2daf384 -rcaa15db89a49c98671f0a87dc2242d0fc7f683b7 --- firmware/source/sys_main.c (.../sys_main.c) (revision 229341f9eb23fec730cdf9b1f8f3960de2daf384) +++ firmware/source/sys_main.c (.../sys_main.c) (revision caa15db89a49c98671f0a87dc2242d0fc7f683b7) @@ -46,6 +46,7 @@ /* USER CODE END */ /* Include Files */ + #include "sys_common.h" /* USER CODE BEGIN (1) */