Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rc1b9ac0dbf2196280895d2e440dd7ac288ac8424 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision c1b9ac0dbf2196280895d2e440dd7ac288ac8424) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -233,7 +233,7 @@ *************************************************************************/ void execDGInterfaceMonitor( void ) { - if ( isACPowerLost() != TRUE ) + if ( FALSE == isACPowerLost() ) { // Trigger alarm if not receiving new load cell data message in timely manner checkDGDataFreshness( ALARM_ID_HD_NEW_LOAD_CELL_DATA_MESSAGE_NOT_RECEIVE, &dgLoadCellDataFreshFlag ); @@ -1258,7 +1258,7 @@ U32 trimmerState = dgHeatersData.trimmerHeaterState; DG_OP_MODE_T dgOp = getDGOpMode(); - if ( isACPowerLost() != TRUE ) + if ( FALSE == isACPowerLost() ) { if ( ( DG_MODE_GENE == dgOp ) || ( DG_MODE_FILL == dgOp ) || ( DG_MODE_DRAI == dgOp ) ) { Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r55ae901025333639420cb770cd5e7c1dca78afd3 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 55ae901025333639420cb770cd5e7c1dca78afd3) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -510,7 +510,7 @@ } else { // Alarm if not receiving new dialysate flow readings in timely manner - if ( ( TRUE == isDGCommunicating() ) && ( isACPowerLost() != TRUE ) ) + if ( ( TRUE == isDGCommunicating() ) && ( FALSE == isACPowerLost() ) ) { if ( ++dialysateFlowDataFreshStatusCounter > DIP_DIALYSATE_FLOW_DATA_ALARM_THRESHOLD ) { Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -r1bff8e530735be63ba557b77557a0bc2ac4b37b2 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision 1bff8e530735be63ba557b77557a0bc2ac4b37b2) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -413,7 +413,7 @@ F32 fansMinAllowedRPM = fansNominalRPM - ( fansNominalRPM * FANS_MIN_RPM_OUT_OF_RANGE_TOL ); F32 fansMaxAllowedRPM = fansNominalRPM + ( fansNominalRPM * FANS_MAX_RPM_OUT_OF_RANGE_TOL ); - if ( isACPowerLost() != TRUE ) + if ( FALSE == isACPowerLost() ) { // Loop through the fans and make sure the each of them have RPM in range for ( fan = FAN_INLET_1; fan < NUM_OF_FANS_NAMES; fan++ ) Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r82bd1d24c050e79690a7f5b236e49dd7db7e2a91 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 82bd1d24c050e79690a7f5b236e49dd7db7e2a91) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -20,6 +20,7 @@ #include "gio.h" #include "Battery.h" +#include "CPLD.h" #include "FPGA.h" #include "MessageSupport.h" #include "NVDataMgmt.h" @@ -925,7 +926,7 @@ state = VALVE_STATE_IDLE; } // Check if the valve's transition time has timed out - else if ( ( TRUE == didTimeout( valvesStatus[ valve ].transitionStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && ( FALSE == isACPowerLost() ) ) + else if ( ( TRUE == didTimeout( valvesStatus[ valve ].transitionStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && ( FALSE == getCPLDACPowerLossDetected() ) ) { // Go back to Idle state and set the valve position to not in position because it was not able to get to the target position valvesStatus[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; @@ -1187,7 +1188,7 @@ for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { // Check the valve is in Idle state, otherwise the position should not be checked - if ( ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) && ( FALSE == isACPowerLost() ) ) + if ( ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) && ( FALSE == getCPLDACPowerLossDetected() ) ) { U32 maxDeviation = MAX_DEVIATION_FROM_TARGET_IN_COUNTS; @@ -1201,25 +1202,28 @@ maxDeviation = MAX_DEVIATION_FROM_TRAGET_IN_POS_B; } - // Check if the current position has deviated from the position it is supposed to be in - // For more than a certain amount of time. If it has, raise an alarm - // Absolute value is used for comparison to cover +/- from the commanded position - if ( abs( currentPosition - commandedPosition ) > maxDeviation ) + if ( FALSE == isACPowerLost() ) { - valvesStatus[ valve ].positionOutOfRangeCounter++; - } + // Check if the current position has deviated from the position it is supposed to be in + // For more than a certain amount of time. If it has, raise an alarm + // Absolute value is used for comparison to cover +/- from the commanded position + if ( abs( currentPosition - commandedPosition ) > maxDeviation ) + { + valvesStatus[ valve ].positionOutOfRangeCounter++; + } - if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) - { - // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. - // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here - // because this is a monitor function that is called in the controller function. - valvesStatus[ valve ].execState = VALVE_STATE_IDLE; - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); - - if ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) + if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) { - activateSafetyShutdown(); + // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. + // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here + // because this is a monitor function that is called in the controller function. + valvesStatus[ valve ].execState = VALVE_STATE_IDLE; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); + + if ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) + { + activateSafetyShutdown(); + } } } else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) @@ -1230,6 +1234,7 @@ else { valvesStatus[ valve ].positionOutOfRangeCounter = 0; + } } } Index: firmware/App/Drivers/Battery.c =================================================================== diff -u -rbf44edd28c59df78a75165764b6b654f2e91e556 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Drivers/Battery.c (.../Battery.c) (revision bf44edd28c59df78a75165764b6b654f2e91e556) +++ firmware/App/Drivers/Battery.c (.../Battery.c) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -221,27 +221,6 @@ /*********************************************************************//** * @brief - * The isACPowerLost function determines whether A/C power loss has been - * detected. - * @details Inputs: none - * @details Outputs: none - * @return TRUE if A/C power loss condition is in effect, FALSE if not - *************************************************************************/ -BOOL isACPowerLost( void ) -{ - BOOL result = TRUE; - - if ( ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST ) ) && - ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST_IN_TREATMENT ) ) ) - { - result = FALSE; - } - - return result; -} - -/*********************************************************************//** - * @brief * The getI2CStatusRegister function returns the I2C status register * @details Inputs: batteryI2CStatusRegister, i2cREG1->STR * @details Outputs: none Index: firmware/App/Drivers/Battery.h =================================================================== diff -u -raa8b9687b9396b4878cf0d5327d72a5d67477761 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Drivers/Battery.h (.../Battery.h) (revision aa8b9687b9396b4878cf0d5327d72a5d67477761) +++ firmware/App/Drivers/Battery.h (.../Battery.h) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -78,7 +78,6 @@ void execBatteryMonitor( void ); BOOL isBatteryCharged( void ); -BOOL isACPowerLost( void ); BOOL testSetBatteryRemainingCapacityOverride( F32 value ); BOOL testResetBatteryRemainingCapacityOverride( void ); Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r2dd1b02e90c90fcd94bf9b21245282205a963654 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 2dd1b02e90c90fcd94bf9b21245282205a963654) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -680,6 +680,31 @@ /*********************************************************************//** * @brief + * The isACPowerLost function determines whether A/C power loss has been + * detected. + * @details Inputs: none + * @details Outputs: none + * @return TRUE if A/C power loss condition is in effect, FALSE if not + *************************************************************************/ +BOOL isACPowerLost( void ) +{ + BOOL result = TRUE; + + if ( ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST ) ) && + ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST_IN_TREATMENT ) ) ) + { + result = FALSE; + } + else + { + alarmsBlockedTimer = ALARM_BLOCKED_COUNT_AFTER_AC_RETURN; + } + + return result; +} + +/*********************************************************************//** + * @brief * The isBloodRecircBlocked function determines whether any currently * active alarm is blocking blood re-circulation. * @details Inputs: alarmStatus Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r2dd1b02e90c90fcd94bf9b21245282205a963654 -r4dda5ae6127e3580137ebf70caf3560e3b268892 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 2dd1b02e90c90fcd94bf9b21245282205a963654) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 4dda5ae6127e3580137ebf70caf3560e3b268892) @@ -206,8 +206,11 @@ BOOL isAlarmActive( ALARM_ID_T alarm ); BOOL isAlarmConditionDetected( ALARM_ID_T alarm ); BOOL isAnyAlarmActive( void ); + +BOOL isACPowerLost( void ); BOOL isBloodRecircBlocked( void ); BOOL isDialysateRecircBlocked( void ); + BOOL doesAlarmStatusIndicateStop( void ); BOOL doesAlarmIndicateNoResume( void ); ALARM_PRIORITY_T getCurrentAlarmStatePriority( void );