Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r29e57b5232f605a871c62580e16a7db297aae992 -r0d8381c50f7189c4cfbc2794a4aedf297eea7d15 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 29e57b5232f605a871c62580e16a7db297aae992) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 0d8381c50f7189c4cfbc2794a4aedf297eea7d15) @@ -907,9 +907,9 @@ { U16 bpMotorHallSensorCount = getFPGABloodPumpHallSensorCount(); U32 nextIdx = INC_WRAP( bpMotorSpeedCalcIdx, 0, BP_SPEED_CALC_BUFFER__LEN - 1 ); - U16 incDelta = ( bpMotorHallSensorCount >= bpLastMotorHallSensorCounts[ bpMotorSpeedCalcIdx ] ? \ - bpMotorHallSensorCount - bpLastMotorHallSensorCounts[ bpMotorSpeedCalcIdx ] : \ - ( HEX_64_K - bpLastMotorHallSensorCounts[ bpMotorSpeedCalcIdx ] ) + bpMotorHallSensorCount ); + U16 incDelta = ( bpMotorHallSensorCount >= bpLastMotorHallSensorCounts[ nextIdx ] ? \ + bpMotorHallSensorCount - bpLastMotorHallSensorCounts[ nextIdx ] : \ + ( HEX_64_K - bpLastMotorHallSensorCounts[ nextIdx ] ) + bpMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; U16 delta; Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r29e57b5232f605a871c62580e16a7db297aae992 -r0d8381c50f7189c4cfbc2794a4aedf297eea7d15 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 29e57b5232f605a871c62580e16a7db297aae992) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 0d8381c50f7189c4cfbc2794a4aedf297eea7d15) @@ -886,9 +886,9 @@ { U16 dipMotorHallSensorCount = getFPGADialInPumpHallSensorCount(); U32 nextIdx = INC_WRAP( dipMotorSpeedCalcIdx, 0, DIP_SPEED_CALC_BUFFER__LEN - 1 ); - U16 incDelta = ( dipMotorHallSensorCount >= dipLastMotorHallSensorCounts[ dipMotorSpeedCalcIdx ] ? \ - dipMotorHallSensorCount - dipLastMotorHallSensorCounts[ dipMotorSpeedCalcIdx ] : \ - ( HEX_64_K - dipLastMotorHallSensorCounts[ dipMotorSpeedCalcIdx ] ) + dipMotorHallSensorCount ); + U16 incDelta = ( dipMotorHallSensorCount >= dipLastMotorHallSensorCounts[ nextIdx ] ? \ + dipMotorHallSensorCount - dipLastMotorHallSensorCounts[ nextIdx ] : \ + ( HEX_64_K - dipLastMotorHallSensorCounts[ nextIdx ] ) + dipMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; U16 delta; Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r29e57b5232f605a871c62580e16a7db297aae992 -r0d8381c50f7189c4cfbc2794a4aedf297eea7d15 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 29e57b5232f605a871c62580e16a7db297aae992) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 0d8381c50f7189c4cfbc2794a4aedf297eea7d15) @@ -752,9 +752,9 @@ { U16 dopMotorHallSensorCount = getFPGADialOutPumpHallSensorCount(); U32 nextIdx = INC_WRAP( dopMotorSpeedCalcIdx, 0, DOP_SPEED_CALC_BUFFER__LEN - 1 ); - U16 incDelta = ( dopMotorHallSensorCount >= dopLastMotorHallSensorCounts[ dopMotorSpeedCalcIdx ] ? \ - dopMotorHallSensorCount - dopLastMotorHallSensorCounts[ dopMotorSpeedCalcIdx ] : \ - ( HEX_64_K - dopLastMotorHallSensorCounts[ dopMotorSpeedCalcIdx ] ) + dopMotorHallSensorCount ); + U16 incDelta = ( dopMotorHallSensorCount >= dopLastMotorHallSensorCounts[ nextIdx ] ? \ + dopMotorHallSensorCount - dopLastMotorHallSensorCounts[ nextIdx ] : \ + ( HEX_64_K - dopLastMotorHallSensorCounts[ nextIdx ] ) + dopMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; U16 delta; Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r0d8381c50f7189c4cfbc2794a4aedf297eea7d15 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 0d8381c50f7189c4cfbc2794a4aedf297eea7d15) @@ -43,6 +43,7 @@ // ********** private data ********** static volatile BOOL modeRequest[ NUM_OF_MODES - 1 ]; ///< Pending operation mode change requests. +static HD_OP_MODE_T lastMode = MODE_INIT; ///< Last operation mode prior to current mode. static HD_OP_MODE_T currentMode = MODE_INIT; ///< Current operation mode. static U32 currentSubMode = 0; ///< The currently active state of the active mode. static U32 broadcastModeIntervalCtr = 11; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. @@ -126,6 +127,7 @@ if ( currentMode != newMode ) { // handle transition to new mode + lastMode = currentMode; transitionToNewOperationMode( newMode ); currentMode = newMode; } @@ -314,4 +316,26 @@ } } +/*********************************************************************//** + * @brief + * The testRestorePriorModeFromFault function restores the operation mode + * to its prior mode if currently in fault mode. + * This is a test function and requires a tester be logged into the HD. + * @details Inputs: lastMode + * @details Outputs: currentMode. + * @return none + *************************************************************************/ +void testRestorePriorModeFromFault( void ) +{ + // verify tester has logged in with HD + if ( TRUE == isTestingActivated() ) + { + // if in fault mode, go back to prior mode + if ( MODE_FAUL == currentMode ) + { + currentMode = lastMode; + } + } +} + /**@}*/ Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -r0d8381c50f7189c4cfbc2794a4aedf297eea7d15 --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 0d8381c50f7189c4cfbc2794a4aedf297eea7d15) @@ -36,8 +36,10 @@ void initOperationModes( void ); // initialize this module void execOperationModes( void ); // execute the operation modes state machine (scheduled periodic call) void requestNewOperationMode( HD_OP_MODE_T newMode ); // request a transition to a new operation mode -HD_OP_MODE_T getCurrentOperationMode( void ); // get the current operation mode +HD_OP_MODE_T getCurrentOperationMode( void ); // get the current operation mode +void testRestorePriorModeFromFault( void ); // test function called when Dialin is clearing a fault + /**@}*/ #endif Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r29e57b5232f605a871c62580e16a7db297aae992 -r0d8381c50f7189c4cfbc2794a4aedf297eea7d15 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 29e57b5232f605a871c62580e16a7db297aae992) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 0d8381c50f7189c4cfbc2794a4aedf297eea7d15) @@ -19,7 +19,6 @@ #include "AlarmLamp.h" #include "OperationModes.h" -#include "SafetyShutdown.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Timers.h" @@ -1045,12 +1044,11 @@ } } } - + // if we're in fault mode, go back to prior mode + testRestorePriorModeFromFault(); result = TRUE; } } - // in case any previously active alarms had pulled safety shutdown, release safety - testResetSafetyShutdownOverride(); return result; }