Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r206e45dff167966b800a628d1708f74e597f1772 -r45627442c3b93ec57ed18cd0943eed2662fb2dbc --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 206e45dff167966b800a628d1708f74e597f1772) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 45627442c3b93ec57ed18cd0943eed2662fb2dbc) @@ -254,6 +254,7 @@ initPersistentAlarm( ALARM_ID_BLOOD_PUMP_MOTOR_SPEED_CHECK, 0, BP_MOTOR_SPEED_ERROR_PERSIST ); initPersistentAlarm( ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_CHECK, 0, BP_ROTOR_SPEED_ERROR_PERSIST ); initPersistentAlarm( ALARM_ID_BLOOD_PUMP_MC_DIRECTION_CHECK, 0, BP_DIRECTION_ERROR_PERSIST ); + initPersistentAlarm( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, 0, BP_DIRECTION_ERROR_PERSIST ); initPersistentAlarm( ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_TOO_HIGH, 0, BP_MAX_ROTOR_SPEED_ERROR_PERSIST ); initPersistentAlarm( ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK, 0, BP_MAX_CURR_ERROR_DURATION_MS ); initPersistentAlarm( ALARM_ID_HD_BLOOD_FLOW_OUT_OF_RANGE, 0, BP_MAX_FLOW_RATE_OUT_OF_RANGE_PERSIST ); @@ -1085,20 +1086,20 @@ { MOTOR_DIR_T bpMCDir, bpDir; BOOL isDirIncorrect; - U08 dirErrorCnt = getFPGABloodPumpHallSensorStatus() & PUMP_DIR_ERROR_COUNT_MASK; + BOOL isHallSensorFailed = ( lastBloodPumpDirectionCount != dirErrorCnt ? TRUE : FALSE ); // Check pump direction error count - if ( lastBloodPumpDirectionCount != dirErrorCnt ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, isHallSensorFailed ) ) { #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMP_DIRECTION_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) #endif { - lastBloodPumpDirectionCount = dirErrorCnt; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_BLOOD_PUMP ) } } + lastBloodPumpDirectionCount = dirErrorCnt; bpMCDir = ( getMeasuredBloodPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); bpDir = ( getMeasuredBloodPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r206e45dff167966b800a628d1708f74e597f1772 -r45627442c3b93ec57ed18cd0943eed2662fb2dbc --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 206e45dff167966b800a628d1708f74e597f1772) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 45627442c3b93ec57ed18cd0943eed2662fb2dbc) @@ -1022,18 +1022,19 @@ { MOTOR_DIR_T dipMCDir, dipDir; U08 dirErrorCnt = getFPGADialInPumpHallSensorStatus() & PUMP_DIR_ERROR_COUNT_MASK; + BOOL isHallSensorFailed = ( lastDialInPumpDirectionCount != dirErrorCnt ? TRUE : FALSE ); // Check pump direction error count - if ( lastDialInPumpDirectionCount != dirErrorCnt ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, isHallSensorFailed ) ) { #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMP_DIRECTION_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) #endif { - lastDialInPumpDirectionCount = dirErrorCnt; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_INLET_PUMP ) } } + lastDialInPumpDirectionCount = dirErrorCnt; dipMCDir = ( getMeasuredDialInPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); dipDir = ( getMeasuredDialInPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r206e45dff167966b800a628d1708f74e597f1772 -r45627442c3b93ec57ed18cd0943eed2662fb2dbc --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 206e45dff167966b800a628d1708f74e597f1772) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 45627442c3b93ec57ed18cd0943eed2662fb2dbc) @@ -27,6 +27,7 @@ #include "ModeTreatment.h" #include "NVDataMgmt.h" #include "OperationModes.h" +#include "PersistentAlarm.h" #include "PIControllers.h" #include "SafetyShutdown.h" #include "SystemCommMessages.h" @@ -935,13 +936,19 @@ { MOTOR_DIR_T dopMCDir, dopDir; U08 dirErrorCnt = getFPGADialOutPumpHallSensorStatus() & PUMP_DIR_ERROR_COUNT_MASK; + BOOL isHallSensorFailed = ( lastDialOutPumpDirectionCount != dirErrorCnt ? TRUE : FALSE ); // Check pump direction error count - if ( lastDialOutPumpDirectionCount != dirErrorCnt ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, isHallSensorFailed ) ) { - lastDialOutPumpDirectionCount = dirErrorCnt; - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_OUTLET_PUMP ) +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMP_DIRECTION_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) +#endif + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_OUTLET_PUMP ) + } } + lastDialOutPumpDirectionCount = dirErrorCnt; dopMCDir = ( getMeasuredDialOutPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); dopDir = ( getMeasuredDialOutPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r72da1ff230f142e1235ea07f9ae06f44e3b17d1a -r45627442c3b93ec57ed18cd0943eed2662fb2dbc --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 72da1ff230f142e1235ea07f9ae06f44e3b17d1a) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 45627442c3b93ec57ed18cd0943eed2662fb2dbc) @@ -709,10 +709,10 @@ S16 targetPosition = valvesStatus[ valve ].targetPositionInCounts; S16 deltaPosition = currentPosition - targetPosition; - // If there has not been any major travel + // Still too far from intermediate target position? Either still more travel to go or stuck at end of travel if ( deltaPosition > MAX_DEVIATION_FROM_TARGET_IN_COUNTS ) { - // Check if the specified time has elapsed + // Are we stuck at end of travel? if ( valvesStatus[ valve ].homingEdgeDetectionCounter >= HOMING_EDGE_DETECTION_TIME_INTERVAL ) { S16 energizedEdge = valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ]; @@ -728,8 +728,7 @@ valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] = currentPosition + INITIAL_EDGE_OFFSET_READ_COUNT; // Position A is the average of the Position B that was read last time and position C that was the target of this state - valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ] = ( valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] - - valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] ) / 2; + valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ] = currentPosition + ( ( valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] - valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] ) / 2 ); #ifndef _RELEASE_ if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_VBA_SPECIAL_POSITION_C ) == SW_CONFIG_ENABLE_VALUE ) && ( VBA == valve ) ) Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r372f524a0baa83b446b7a69bd869cfdea59ce295 -r45627442c3b93ec57ed18cd0943eed2662fb2dbc --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 372f524a0baa83b446b7a69bd869cfdea59ce295) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 45627442c3b93ec57ed18cd0943eed2662fb2dbc) @@ -400,13 +400,6 @@ data.opMode = (U32)currentMode; data.subMode = currentSubMode; broadcastData( MSG_ID_HD_OP_MODE, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&data, sizeof( OP_MODE_PAYLOAD_T ) ); - - // TODO remove this debug output - // Send a comma delimited debug message with drift data - F32 test = 12.2; - char tempCharBuffer[ 64 ]; - sprintf( tempCharBuffer, "LoadCellOldDrift, %3.2f,LoadCellNewDrift, %3.2f", test, test ); - broadcastData( MSG_ID_HD_DEBUG_EVENT, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)tempCharBuffer, strlen( tempCharBuffer ) ); } } Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -rd6255708e8305bf5509485a860eb3469a42ec9ad -r45627442c3b93ec57ed18cd0943eed2662fb2dbc --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision d6255708e8305bf5509485a860eb3469a42ec9ad) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 45627442c3b93ec57ed18cd0943eed2662fb2dbc) @@ -389,8 +389,6 @@ *************************************************************************/ void execDrySelfTests( void ) { - SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; - // execute dry self-tests state machine switch ( currentDrySelfTestsState ) { @@ -467,11 +465,6 @@ // Self-tests flags should be handled by now, reset if flags not handled with current state resetSelfTestsFlags(); - if ( SELF_TEST_STATUS_FAILED == result ) - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_PRE_TREATMENT_DRY_PRESSURE_TEST_FAILURE, currentDrySelfTestsState ); - } - // Publish current self-test time data if ( calcTimeSince( selfTestPreviousPublishDataTime ) >= SELF_TEST_TIME_DATA_PUB_INTERVAL ) { @@ -1587,8 +1580,11 @@ { WET_SELF_TESTS_STATE_T state = WET_SELF_TESTS_STOPPED_STATE; + doorClosedRequired( FALSE, FALSE ); + if ( TRUE == selfTestsResumeRequested ) { + doorClosedRequired( TRUE, TRUE ); selfTestsResumeRequested = FALSE; state = WET_SELF_TESTS_START_STATE; }