Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rf8feb10a7e19e17148e4ce8b247316c9772d1753 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision f8feb10a7e19e17148e4ce8b247316c9772d1753) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -55,7 +55,8 @@ #define BP_HOME_RATE 100 ///< target pump speed (in estimate mL/min) for homing. #define BP_HOME_TIMEOUT_MS 10000 ///< maximum time allowed for homing to complete (in ms). -#define BP_SPEED_CALC_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the blood pump speed is calculated. +#define BP_SPEED_CALC_INTERVAL ( 40 / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the blood pump speed is calculated. +#define BP_SPEED_CALC_BUFFER__LEN 25 ///< number of hall sensor counts kept in buffer to hold last 1 second of count data. #define BP_HALL_EDGE_COUNTS_PER_REV 48 ///< number of hall sensor edge counts per motor revolution. #define BP_MAX_ROTOR_SPEED_RPM 100.0 ///< maximum rotor speed allowed for blood pump. @@ -150,9 +151,10 @@ static BOOL bpStopAtHomePosition = FALSE; ///< stop blood pump at next home position static U32 bpHomeStartTime = 0; ///< when did blood pump home command begin? (in ms) -static U16 bpLastMotorHallSensorCount = 0; ///< last hall sensor count for the blood pump motor +static U16 bpLastMotorHallSensorCounts[ BP_SPEED_CALC_BUFFER__LEN ]; ///< last hall sensor count for the blood pump motor +static U32 bpMotorSpeedCalcIdx = 0; ///< index into 1 second buffer of motor speed hall sensor counts static MOTOR_DIR_T bpMotorDirectionFromHallSensors = MOTOR_DIR_FORWARD; ///< pump direction according to hall sensor count -static U32 bpMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating blood pump motor speed from hall sensor count. +static U32 bpMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating blood pump motor speed from hall sensor count. static U32 errorBloodFlowVsMotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for flow vs. motor speed error condition. static U32 errorBloodMotorOffPersistTimerCtr = 0; ///< persistence timer counter for motor off check error condition. @@ -199,15 +201,22 @@ * @return none *************************************************************************/ void initBloodFlow( void ) -{ - bpLastMotorHallSensorCount = getFPGABloodPumpHallSensorCount(); +{ + U32 i; stopBloodPump(); setBloodPumpDirection( MOTOR_DIR_FORWARD ); // zero rolling flow average buffer resetBloodFlowMovingAverage(); - + + // zero motor hall sensors counts buffer + bpMotorSpeedCalcIdx = 0; + for ( i = 0; i < BP_SPEED_CALC_BUFFER__LEN; i++ ) + { + bpLastMotorHallSensorCounts[ i ] = 0; + } + // initialize blood flow PI controller initializePIController( PI_CONTROLLER_ID_BLOOD_FLOW, MIN_BLOOD_PUMP_PWM_DUTY_CYCLE, BP_P_COEFFICIENT, BP_I_COEFFICIENT, @@ -894,8 +903,9 @@ { if ( ++bpMotorSpeedCalcTimerCtr >= BP_SPEED_CALC_INTERVAL ) { - U16 bpMotorHallSensorCount = getFPGABloodPumpHallSensorCount(); - U16 incDelta = ( bpMotorHallSensorCount >= bpLastMotorHallSensorCount ? bpMotorHallSensorCount - bpLastMotorHallSensorCount : ( HEX_64_K - bpLastMotorHallSensorCount ) + bpMotorHallSensorCount ); + U16 bpMotorHallSensorCount = getFPGABloodPumpHallSensorCount(); + U32 nextIdx = INC_WRAP( bpMotorSpeedCalcIdx, 0, BP_SPEED_CALC_BUFFER__LEN - 1 ); + U16 incDelta = ( bpMotorHallSensorCount >= bpLastMotorHallSensorCounts[ nextIdx ] ? bpMotorHallSensorCount - bpLastMotorHallSensorCounts[ nextIdx ] : ( HEX_64_K - bpLastMotorHallSensorCounts[ nextIdx ] ) + bpMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; U16 delta; @@ -914,7 +924,8 @@ } // update last count for next time - bpLastMotorHallSensorCount = bpMotorHallSensorCount; + bpLastMotorHallSensorCounts[ nextIdx ] = bpMotorHallSensorCount; + bpMotorSpeedCalcIdx = nextIdx; bpMotorSpeedCalcTimerCtr = 0; } } Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -52,7 +52,8 @@ #define DIP_HOME_RATE 100 ///< target pump speed (in estimate mL/min) for homing. #define DIP_HOME_TIMEOUT_MS 10000 ///< maximum time allowed for homing to complete (in ms). -#define DIP_SPEED_CALC_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the dialysate inlet pump speed is calculated. +#define DIP_SPEED_CALC_INTERVAL ( 40 / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the dialysate inlet pump speed is calculated. +#define DIP_SPEED_CALC_BUFFER__LEN 25 ///< number of hall sensor counts kept in buffer to hold last 1 second of count data. #define DIP_HALL_EDGE_COUNTS_PER_REV 48 ///< number of hall sensor edge counts per motor revolution. #define DIP_MAX_FLOW_VS_SPEED_DIFF_ML_MIN 50.0 ///< maximum difference between measured flow and flow implied by measured motor speed. @@ -147,7 +148,8 @@ static BOOL dipStopAtHomePosition = FALSE; ///< stop dialysate inlet pump at next home position static U32 dipHomeStartTime = 0; ///< when did dialysate inlet pump home command begin? (in ms) -static U16 dipLastMotorHallSensorCount = 0; ///< last hall sensor count for the dialysate inlet pump motor +static U16 dipLastMotorHallSensorCounts[ DIP_SPEED_CALC_BUFFER__LEN ]; ///< last hall sensor count for the blood pump motor +static U32 dipMotorSpeedCalcIdx = 0; ///< index into 1 second buffer of motor speed hall sensor counts static MOTOR_DIR_T dipMotorDirectionFromHallSensors = MOTOR_DIR_FORWARD; ///< pump direction according to hall sensor count static U32 dipMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating dialysate inlet pump motor speed from hall sensor count. @@ -196,15 +198,22 @@ * @return none *************************************************************************/ void initDialInFlow( void ) -{ - dipLastMotorHallSensorCount = getFPGADialInPumpHallSensorCount(); +{ + U32 i; stopDialInPump(); setDialInPumpDirection( MOTOR_DIR_FORWARD ); // zero rolling flow average buffer resetDialInFlowMovingAverage(); + // zero motor hall sensors counts buffer + dipMotorSpeedCalcIdx = 0; + for ( i = 0; i < DIP_SPEED_CALC_BUFFER__LEN; i++ ) + { + dipLastMotorHallSensorCounts[ i ] = 0; + } + // initialize dialysate inlet flow PI controller initializePIController( PI_CONTROLLER_ID_DIALYSATE_FLOW, MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE, DIP_P_COEFFICIENT, DIP_I_COEFFICIENT, @@ -874,7 +883,8 @@ if ( ++dipMotorSpeedCalcTimerCtr >= DIP_SPEED_CALC_INTERVAL ) { U16 dipMotorHallSensorCount = getFPGADialInPumpHallSensorCount(); - U16 incDelta = ( dipMotorHallSensorCount >= dipLastMotorHallSensorCount ? dipMotorHallSensorCount - dipLastMotorHallSensorCount : ( HEX_64_K - dipLastMotorHallSensorCount ) + dipMotorHallSensorCount ); + U32 nextIdx = INC_WRAP( dipMotorSpeedCalcIdx, 0, DIP_SPEED_CALC_BUFFER__LEN - 1 ); + U16 incDelta = ( dipMotorHallSensorCount >= dipLastMotorHallSensorCounts[ nextIdx ] ? dipMotorHallSensorCount - dipLastMotorHallSensorCounts[ nextIdx ] : ( HEX_64_K - dipLastMotorHallSensorCounts[ nextIdx ] ) + dipMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; U16 delta; @@ -893,7 +903,8 @@ } // update last count for next time - dipLastMotorHallSensorCount = dipMotorHallSensorCount; + dipLastMotorHallSensorCounts[ nextIdx ] = dipMotorHallSensorCount; + dipMotorSpeedCalcIdx = nextIdx; dipMotorSpeedCalcTimerCtr = 0; } } Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -55,7 +55,8 @@ #define DOP_HOME_RATE 100 ///< target pump speed (in estimate mL/min) for homing. #define DOP_HOME_TIMEOUT_MS 10000 ///< maximum time allowed for homing to complete (in ms). -#define DOP_SPEED_CALC_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the dialysate outlet pump speed is calculated. +#define DOP_SPEED_CALC_INTERVAL ( 40 / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the dialysate outlet pump speed is calculated. +#define DOP_SPEED_CALC_BUFFER__LEN 25 ///< number of hall sensor counts kept in buffer to hold last 1 second of count data. #define DOP_HALL_EDGE_COUNTS_PER_REV 48 ///< number of hall sensor edge counts per motor revolution. #define DOP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< maximum motor speed (RPM) while motor is commanded off. @@ -146,7 +147,8 @@ static BOOL dopStopAtHomePosition = FALSE; ///< stop dialysate outlet pump at next home position static U32 dopHomeStartTime = 0; ///< when did dialysate outlet pump home command begin? (in ms) -static U16 dopLastMotorHallSensorCount = 0; ///< last hall sensor count for the dialysate outlet pump motor +static U16 dopLastMotorHallSensorCounts[ DOP_SPEED_CALC_BUFFER__LEN ]; ///< last hall sensor count for the blood pump motor +static U32 dopMotorSpeedCalcIdx = 0; ///< index into 1 second buffer of motor speed hall sensor counts static MOTOR_DIR_T dopMotorDirectionFromHallSensors = MOTOR_DIR_FORWARD; ///< pump direction according to hall sensor count static U32 dopMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating dialysate outlet pump motor speed from hall sensor count. @@ -157,9 +159,6 @@ static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; ///< Current state of the dialysate outlet pump self-test state machine. static U32 dialOutPumpSelfTestTimerCount = 0; ///< Timer counter for time reference during self-test. -// Broadcasting record -DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; ///< Record containing latest dialysate outlet data for broadcasting. - // ********** private function prototypes ********** static DIAL_OUT_PUMP_STATE_T handleDialOutPumpOffState( void ); @@ -194,26 +193,22 @@ { U32 i; - dopLastMotorHallSensorCount = getFPGADialOutPumpHallSensorCount(); - stopDialOutPump(); setDialOutPumpDirection( MOTOR_DIR_FORWARD ); + // zero motor hall sensors counts buffer + dopMotorSpeedCalcIdx = 0; + for ( i = 0; i < DOP_SPEED_CALC_BUFFER__LEN; i++ ) + { + dopLastMotorHallSensorCounts[ i ] = 0; + } + // initialize load cell weights for ( i = 0; i < NUM_OF_LOAD_CELLS; i++ ) { loadCellWeightInGrams[ i ].data = 0.0; } - // initialize broadcast data - dialOutBroadCastVariables.refUFVolMl = 0.0; - dialOutBroadCastVariables.measUFVolMl = 0.0; - dialOutBroadCastVariables.measRotSpdRPM = 0.0; - dialOutBroadCastVariables.measSpdRPM = 0.0; - dialOutBroadCastVariables.measMCSpdRPM = 0.0; - dialOutBroadCastVariables.measMCCurrmA = 0.0; - dialOutBroadCastVariables.setPWMpct = 0.0; - // initialize dialysate outlet flow PI controller initializePIController( PI_CONTROLLER_ID_ULTRAFILTRATION, MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE, DOP_P_COEFFICIENT, DOP_I_COEFFICIENT, @@ -724,6 +719,8 @@ // publish dialysate outlet pump and UF volume data on interval if ( ++dialOutFlowDataPublicationTimerCounter >= getPublishDialOutDataInterval() ) { + DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; + dialOutBroadCastVariables.refUFVolMl = getTotalTargetDialOutUFVolumeInMl(); dialOutBroadCastVariables.measUFVolMl = getTotalMeasuredUFVolumeInMl(); dialOutBroadCastVariables.measRotSpdRPM = getMeasuredDialOutPumpRotorSpeed(); @@ -752,7 +749,8 @@ if ( ++dopMotorSpeedCalcTimerCtr >= DOP_SPEED_CALC_INTERVAL ) { U16 dopMotorHallSensorCount = getFPGADialOutPumpHallSensorCount(); - U16 incDelta = ( dopMotorHallSensorCount >= dopLastMotorHallSensorCount ? dopMotorHallSensorCount - dopLastMotorHallSensorCount : ( HEX_64_K - dopLastMotorHallSensorCount ) + dopMotorHallSensorCount ); + U32 nextIdx = INC_WRAP( dopMotorSpeedCalcIdx, 0, DOP_SPEED_CALC_BUFFER__LEN - 1 ); + U16 incDelta = ( dopMotorHallSensorCount >= dopLastMotorHallSensorCounts[ nextIdx ] ? dopMotorHallSensorCount - dopLastMotorHallSensorCounts[ nextIdx ] : ( HEX_64_K - dopLastMotorHallSensorCounts[ nextIdx ] ) + dopMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; U16 delta; @@ -771,7 +769,8 @@ } // update last count for next time - dopLastMotorHallSensorCount = dopMotorHallSensorCount; + dopLastMotorHallSensorCounts[ nextIdx ] = dopMotorHallSensorCount; + dopMotorSpeedCalcIdx = nextIdx; dopMotorSpeedCalcTimerCtr = 0; } } Index: firmware/App/HDCommon.h =================================================================== diff -u -r62a09fa67dc30631186f3e4d7a62437c1108c31a -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 62a09fa67dc30631186f3e4d7a62437c1108c31a) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -48,7 +48,7 @@ #define DISABLE_PUMP_DIRECTION_CHECKS 1 // do not error on HD pump direction checks #define DISABLE_PRESSURE_CHECKS 1 // do not error on HD pressure checks #define DISABLE_UF_ALARMS 1 // do not error on HD ultrafiltration checks - #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) +// #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // #define RAW_FLOW_SENSOR_DATA 1 // test build will not filter flow sensor data // #define READ_FPGA_ASYNC_DATA 1 // test build reads non-priority register page every other time // #define FLOW_DEBUG 1 // test build sends flow, signal strength, and occlusion readings to debug UART Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -104,7 +104,7 @@ case POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); - postState = handlePOSTStatus( testStatus ); // ignoring return value because last test + postState = handlePOSTStatus( testStatus ); break; case POST_STATE_ALARM_LAMP: @@ -146,9 +146,13 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_VALVES: + postState = POST_STATE_STUCK_BUTTON; + break; + case POST_STATE_STUCK_BUTTON: testStatus = execStuckButtonTest(); - handlePOSTStatus( testStatus ); + handlePOSTStatus( testStatus ); // ignoring return value because last test if ( TRUE == tempPOSTPassed ) { Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rf8feb10a7e19e17148e4ce8b247316c9772d1753 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision f8feb10a7e19e17148e4ce8b247316c9772d1753) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -37,7 +37,9 @@ #define ALM_ESC_1_MIN (1 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 1 minute. #define ALM_ESC_4_MIN (4 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 4 minutes. #define ALM_ESC_5_MIN (5 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 5 minutes. -#define ALM_ESC_10_MIN (10 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 10 minutes. +#define ALM_ESC_10_MIN (10 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 10 minutes. + +#define SUPERVISOR_ALARM_KEY 0xD2C3B4A5 ///< 32-bit key required for clear all alarms request. #pragma pack(push,1) /// Record defining the properties of each individual alarm. @@ -153,6 +155,10 @@ { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_SALINE_BOLUS_VOLUME_CHECK_FAILURE { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_ARTERIAL_PRESSURE_SENSOR_FAULT { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT + { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_UV_REACTOR_NOT_HEALTHY + { ALARM_PRIORITY_HIGH, ALM_ESC_4_MIN, ALARM_ID_BLOOD_SITTING_WARNING, FALSE, TRUE , FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, // ALARM_ID_POST_ACID_CONDUCTIVITY_OUT_OF_RANGE + { ALARM_PRIORITY_HIGH, ALM_ESC_4_MIN, ALARM_ID_BLOOD_SITTING_WARNING, FALSE, TRUE , FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, // ALARM_ID_POST_BICARB_CONDUCTIVITY_OUT_OF_RANGE + { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_RO_PUMP_FLOW_RATE_OUT_OF_RANGE }; // *** This declaration will cause a compiler error if alarmTable does not have same # of alarms as the Alarm_List enumeration. @@ -839,6 +845,7 @@ { BOOL result = FALSE; + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { U32 intvl = value / TASK_GENERAL_INTERVAL; @@ -864,6 +871,7 @@ { BOOL result = FALSE; + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { result = TRUE; @@ -892,6 +900,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { if ( TRUE == state ) @@ -925,6 +934,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { result = TRUE; @@ -952,6 +962,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { U32 tim = getMSTimerCount(); @@ -984,6 +995,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { result = TRUE; @@ -993,6 +1005,51 @@ } return result; +} + +/*********************************************************************//** + * @brief + * The testClearAllAlarms function clears all active alarms, even if they + * are non-recoverable or faults. The caller of this function must provide + * the correct 32-bit key. A Dialin user must also be logged into HD. + * @details Inputs: none + * @details Outputs: alarmIsActive[], alarmStartedAt[] + * @param key 32-bit supervior alarm key required to perform this function + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testClearAllAlarms( U32 key ) +{ + BOOL result = FALSE; + + // verify key + if ( SUPERVISOR_ALARM_KEY == key ) + { + // verify tester has logged in with HD + if ( TRUE == isTestingActivated() ) + { + ALARM_ID_T a; + + // clear all active alarms + for ( a = ALARM_ID_NO_ALARM; a < NUM_OF_ALARM_IDS; a++ ) + { + if ( TRUE == alarmIsActive[ a ] ) + { + broadcastAlarmCleared( a ); + alarmIsActive[ a ] = FALSE; + alarmStartedAt[ a ].data = 0; + // clear FIFO if this alarm was in it + if ( alarmPriorityFIFO[ alarmTable[ a ].alarmPriority ] == a ) + { + resetAlarmPriorityFIFO( alarmTable[ a ].alarmPriority ); + } + } + } + + result = TRUE; + } + } + + return result; } /**@}*/ Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -rb34eab65955f1681758069584bf6d1cda7fee846 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision b34eab65955f1681758069584bf6d1cda7fee846) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -212,7 +212,8 @@ BOOL testSetAlarmStateOverride( U32 alarmID, BOOL value ); BOOL testResetAlarmStateOverride( U32 alarmID ); BOOL testSetAlarmStartOverride( U32 alarmID, U32 value ); -BOOL testResetAlarmStartOverride( U32 alarmID ); +BOOL testResetAlarmStartOverride( U32 alarmID ); +BOOL testClearAllAlarms( U32 key ); /**@}*/ Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -1410,6 +1410,14 @@ handleTestSetTreatmentParameter( message ); break; + case MSG_ID_SUPER_CLEAR_ALARMS_CMD: + handleTestSuperClearAlarmsRequest( message ); + break; + + case MSG_ID_HD_REQUEST_CALIBRATION_DATA: + handleTestHDCalibrationDataRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rf8feb10a7e19e17148e4ce8b247316c9772d1753 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f8feb10a7e19e17148e4ce8b247316c9772d1753) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -3360,8 +3360,8 @@ /*********************************************************************//** * @brief - * The handleSetDialysateFlowCalibration function handles a request to set - * dialysate flow calibration factors. + * The handleTestSetTreatmentParameter function handles a request to set + * a given treatment parameter. * @details * Inputs : none * Outputs : message handled @@ -3384,4 +3384,54 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestSuperClearAlarmsRequest function handles a request to clear + * all active alarms. + * @details + * Inputs : none + * Outputs : message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSuperClearAlarmsRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 key; + + memcpy( &key, message->payload, sizeof(U32) ); + result = testClearAllAlarms( key ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDCalibrationDataRequest function handles a request for + * HD calibration data. + * @details + * Inputs : none + * Outputs : message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDCalibrationDataRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + // TODO - call TBD function in NVDataMgmt to send calibration data + result = FALSE; + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rb34eab65955f1681758069584bf6d1cda7fee846 -r5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision b34eab65955f1681758069584bf6d1cda7fee846) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5e77f78c5dee9dfb441bd5d2053f7f4ac50dc619) @@ -344,6 +344,12 @@ // MSG_ID_HD_SET_PARAMETER_TREATMENT_PARAMETER void handleTestSetTreatmentParameter( MESSAGE_T *message ); + +// MSG_ID_SUPER_CLEAR_ALARMS_CMD +void handleTestSuperClearAlarmsRequest( MESSAGE_T *message ); + +// MSG_ID_HD_REQUEST_CALIBRATION_DATA +void handleTestHDCalibrationDataRequest( MESSAGE_T *message ); /**@}*/