Index: firmware/App/Controllers/Ejector.c =================================================================== diff -u -rfe9b77e60850fe37da225d4348f0a6a8defc28db -r9a8e1fc597eb4f681527e691fb6cb24e550d8b92 --- firmware/App/Controllers/Ejector.c (.../Ejector.c) (revision fe9b77e60850fe37da225d4348f0a6a8defc28db) +++ firmware/App/Controllers/Ejector.c (.../Ejector.c) (revision 9a8e1fc597eb4f681527e691fb6cb24e550d8b92) @@ -199,15 +199,26 @@ /*********************************************************************//** * @brief * The abortEjectorOperation function requests an ejector abort operation. - * @details \b Inputs: none + * @details \b Inputs: currentEjectorState * @details \b Outputs: ejectorAbortRequested * @return none *************************************************************************/ void abortEjectorOperation( void ) { - setEjectorMotorSpeed( EJECTOR_OFF_MOTOR_SPEED_RPM ); - // Set the flag to TRUE regardless of where the ejector is at - ejectorAbortRequested = TRUE; + switch ( currentEjectorState ) + { + case EJECTOR_STATE_HOMING: + case EJECTOR_STATE_RETRACTING: + case EJECTOR_STATE_EXTENDING: + setEjectorMotorSpeed( EJECTOR_OFF_MOTOR_SPEED_RPM ); + // Set the flag to TRUE regardless of where the ejector is at + ejectorAbortRequested = TRUE; + break; + + default: + // Do nothing on the rest of the states. Only initiate the abort sequence if an operation is in progress. + break; + } } /*********************************************************************//** Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -rb0ae8e670f18913bf88da41394ac28b111d184ea -r9a8e1fc597eb4f681527e691fb6cb24e550d8b92 --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision b0ae8e670f18913bf88da41394ac28b111d184ea) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 9a8e1fc597eb4f681527e691fb6cb24e550d8b92) @@ -308,12 +308,12 @@ { if ( bloodSittingTimerCtr > WARN_TIME_BLOOD_SITTING ) { - //activateAlarmNoData( ALARM_ID_HD_BLOOD_SITTING_WARNING ); + activateAlarmNoData( ALARM_ID_TD_BLOOD_SITTING_WARNING ); } if ( bloodSittingTimerCtr > MAX_TIME_BLOOD_SITTING ) { // Activate the alarm - //activateAlarmNoData( ALARM_ID_HD_TREATMENT_STOPPED_NO_RINSEBACK ); + activateAlarmNoData( ALARM_ID_TD_BLOOD_SITTING_TOO_LONG ); } } } Index: firmware/App/Services/AlarmMgmtTD.c =================================================================== diff -u -r56a3c9023fc6055f73c0bc53fb829aeccf7dbf6c -r9a8e1fc597eb4f681527e691fb6cb24e550d8b92 --- firmware/App/Services/AlarmMgmtTD.c (.../AlarmMgmtTD.c) (revision 56a3c9023fc6055f73c0bc53fb829aeccf7dbf6c) +++ firmware/App/Services/AlarmMgmtTD.c (.../AlarmMgmtTD.c) (revision 9a8e1fc597eb4f681527e691fb6cb24e550d8b92) @@ -683,6 +683,107 @@ /*********************************************************************//** * @brief + * The handleAlarmTriggered function handles the triggered alarm from the other + * stacks. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Pointer to the triggered alarm message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL handleAlarmTriggered( MESSAGE_T *message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof( ALARM_TRIGGERED_PAYLOAD_T ) ) + { + ALARM_TRIGGERED_PAYLOAD_T payload; + U08 *payloadPtr = message->payload; + + memcpy( &payload, payloadPtr, sizeof( ALARM_TRIGGERED_PAYLOAD_T ) ); + + if ( (ALARM_ID_T)(payload.alarm) < NUM_OF_ALARM_IDS ) + { + ALARM_DATA_T alm1, alm2; + + status = TRUE; + alm1.dataType = (ALARM_DATA_TYPES_T)(payload.almDataType1); + alm1.data.uInt.data = payload.almData1; + alm2.dataType = (ALARM_DATA_TYPES_T)(payload.almDataType2); + alm2.data.uInt.data = payload.almData2; + activateAlarm2Data( (ALARM_ID_T)(payload.alarm), alm1, alm2, TRUE ); + } + } + + return status; +} + +/*********************************************************************//** + * @brief + * The handleAlarmConditionCleared function handles the cleared alarm from + * the other stacks. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Pointer to the cleared alarm message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL handleAlarmConditionCleared( MESSAGE_T *message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U08 *payloadPtr = message->payload; + U32 alarmID; + + memcpy( &alarmID, payloadPtr, sizeof( U32 ) ); + + if ( (ALARM_ID_T)alarmID < NUM_OF_ALARM_IDS ) + { + clearAlarmCondition( (ALARM_ID_T)alarmID ); + status = TRUE; + } + } + + return status; +} + +/*********************************************************************//** + * @brief + * The handleAlarmUserAction function handles the alarm user action that is + * received from the UI. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message Pointer to the user action request message + * @return TRUE if message handled successfully, FALSE if not + *************************************************************************/ +BOOL handleAlarmUserAction( MESSAGE_T *message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U08 *payloadPtr = message->payload; + U32 action; + + memcpy( &action, payloadPtr, sizeof( U32 ) ); + + if ( (ALARM_USER_ACTION_T)action < NUMBER_OF_ALARM_USER_ACTIONS ) + { + signalAlarmUserActionInitiated( (ALARM_USER_ACTION_T)action ); + } + + status = TRUE; + } + else + { + //sendMessage( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_TD_2_UI, ACK_NOT_REQUIRED ); // TODO do we have to send a response? + } + + return status; +} + +/*********************************************************************//** + * @brief * The handleActiveAlarmListRequest function handles the active alarms list * request from UI. * @note Active alarm list is sorted by rank and is limited to maximum 10 alarm @@ -787,7 +888,7 @@ if ( TRUE == props.alarmAutoResume ) { - if ( ( alarm == alarmStatus.alarmTop ) && ( FALSE == props.alarmNoResume ) ) + if ( ( alarm == alarmStatus.alarmTop ) && ( FALSE == alarmStatus.noResume ) ) { signalAlarmUserActionInitiated( ALARM_USER_ACTION_RESUME ); } Index: firmware/App/Services/AlarmMgmtTD.h =================================================================== diff -u -r56a3c9023fc6055f73c0bc53fb829aeccf7dbf6c -r9a8e1fc597eb4f681527e691fb6cb24e550d8b92 --- firmware/App/Services/AlarmMgmtTD.h (.../AlarmMgmtTD.h) (revision 56a3c9023fc6055f73c0bc53fb829aeccf7dbf6c) +++ firmware/App/Services/AlarmMgmtTD.h (.../AlarmMgmtTD.h) (revision 9a8e1fc597eb4f681527e691fb6cb24e550d8b92) @@ -149,6 +149,9 @@ BOOL doesAlarmStatusIndicateEndTxOnly( void ); ALARM_PRIORITY_T getCurrentAlarmStatePriority( void ); +BOOL handleAlarmTriggered( MESSAGE_T *message ); +BOOL handleAlarmConditionCleared( MESSAGE_T *message ); +BOOL handleAlarmUserAction( MESSAGE_T *message ); BOOL handleActiveAlarmListRequest( MESSAGE_T *message ); void handleResendActiveAlarmsRequest( void ); void handleAutoResumeAlarm( ALARM_ID_T alarm ); Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r842fe6e438c788fc3e1206615202b2decc82f8a3 -r9a8e1fc597eb4f681527e691fb6cb24e550d8b92 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 842fe6e438c788fc3e1206615202b2decc82f8a3) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 9a8e1fc597eb4f681527e691fb6cb24e550d8b92) @@ -97,6 +97,9 @@ /// Message handling function lookup table static const MSG_HANDLER_LOOKUP_T MSG_FUNCTION_HANDLER_LOOKUP[] = { + { MSG_ID_ALARM_TRIGGERED, &handleAlarmTriggered }, + { MSG_ID_ALARM_CONDITION_CLEARED, &handleAlarmConditionCleared }, + { MSG_ID_UI_ALARM_USER_ACTION_REQUEST, &handleAlarmUserAction }, { MSG_ID_UI_ACTIVE_ALARMS_LIST_REQUEST, &handleActiveAlarmListRequest }, { MSG_ID_FW_VERSIONS_REQUEST, &handleVersionRequestMessage }, { MSG_ID_UI_CHECK_IN, &handleUICheckIn },