Index: firmware/App/HDCommon.h =================================================================== diff -u -r4188fcf05de7e9d1d3e8bb21678d7b0003ff580e -r2fa2467ff29d05346bcb1586f2ed339f34d853b2 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 4188fcf05de7e9d1d3e8bb21678d7b0003ff580e) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 2fa2467ff29d05346bcb1586f2ed339f34d853b2) @@ -33,7 +33,6 @@ #ifndef _VECTORCAST_ // Build switches. NOTE: These build switches are never considered for release builds. // #define BOARD_WITH_NO_HARDWARE 1 // Target is a PCB w/ no hardware -// #define RUN_WITHOUT_DG 1 // Run HD w/o DG // #define SIMULATE_UI 1 // Build w/o requirement that UI be there // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rceeba51c01b896855eb03ab81281a2b0f48c75d2 -r2fa2467ff29d05346bcb1586f2ed339f34d853b2 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision ceeba51c01b896855eb03ab81281a2b0f48c75d2) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 2fa2467ff29d05346bcb1586f2ed339f34d853b2) @@ -186,7 +186,6 @@ handleDisinfectCancel( stop ); -#ifndef RUN_WITHOUT_DG // State machine to get DG to prep a reservoir so we can start a treatment switch ( currentStandbyState ) { @@ -243,33 +242,7 @@ currentStandbyState = STANDBY_START_STATE; break; } -#else - // State machine to get DG to prep a reservoir so we can start a treatment - switch ( currentStandbyState ) - { - case STANDBY_START_STATE: - currentStandbyState = STANDBY_WAIT_FOR_TREATMENT_STATE; - // Temporary test code - TODO - remove later - homeBloodPump(); - homeDialInPump(); - homeDialOutPump(); - break; - case STANDBY_WAIT_FOR_TREATMENT_STATE: - if ( TRUE == treatStartReqReceived ) - { - requestNewOperationMode( MODE_TPAR ); - treatStartReqReceived = FALSE; - } - break; - - default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_STANDBY_INVALID_STATE, currentStandbyState ); - currentStandbyState = STANDBY_START_STATE; - break; - } -#endif - return currentStandbyState; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r9576fd573a9dfefb502da5668841ea5f7fe072f1 -r2fa2467ff29d05346bcb1586f2ed339f34d853b2 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 9576fd573a9dfefb502da5668841ea5f7fe072f1) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 2fa2467ff29d05346bcb1586f2ed339f34d853b2) @@ -42,7 +42,7 @@ #define BROADCAST_HD_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< HD operation mode broadcast interval (in task interval/sec). #define DATA_PUBLISH_COUNTER_START_COUNT 11 ///< Data publish counter start count. -#define NUM_CONFIRM_REQUESTS 4 ///< Number of available confirmation requests. +#define MAX_PENDING_CONFIRM_REQUESTS 4 ///< Maximum number of confirmation requests allowed at any given time. #define CONFIRMATION_REQUEST_TIMEOUT_MS ( SEC_PER_MIN * MS_PER_SECOND ) ///< Confirmation response timeout in ms /// Structure for confirmation request. @@ -64,7 +64,7 @@ /// Interval (in task intervals) at which to publish operation mode data to CAN bus. static OVERRIDE_U32_T opModePublishInterval = { BROADCAST_HD_OP_MODE_INTERVAL, BROADCAST_HD_OP_MODE_INTERVAL, BROADCAST_HD_OP_MODE_INTERVAL, 0 }; /// Local structure init for saving confirmation requests -static CONFIRMATION_REQUEST_T confirmRequests[NUM_CONFIRM_REQUESTS] = +static CONFIRMATION_REQUEST_T confirmRequests[ MAX_PENDING_CONFIRM_REQUESTS ] = { GENERIC_CONFIRM_ID_NONE, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, GENERIC_CONFIRM_ID_NONE, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, GENERIC_CONFIRM_ID_NONE, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, @@ -433,14 +433,13 @@ * all active confirmation requests and updates the timeout. * @details Inputs: confirmRequests[] * @details Outputs: confirmRequests[] status updated if timeout. - * @param none * @return none *************************************************************************/ void updateConfirmationRequestTimeouts( void ) { U08 i; - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { if ( CONFIRMATION_REQUEST_STATUS_PENDING == confirmRequests[ i ].status ) { @@ -456,9 +455,9 @@ * @brief * The getConfirmationRequestStatus function returns the status of a confirmation request * @details Inputs: confirmRequests[] - * @details Outputs: confirmRequests[] cleared if completed. - * @param request ID - * @return CONFIRMATION_REQUEST_STATUS_T + * @details Outputs: confirmRequests[] consumed/cleared if completed. + * @param request_id ID of confirmation being requested + * @return Status of given confirmation *************************************************************************/ CONFIRMATION_REQUEST_STATUS_T getConfirmationRequestStatus( GENERIC_CONFIRM_ID_T request_id ) { @@ -467,15 +466,15 @@ BOOL pending = FALSE; U08 pending_index = 0; - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { if ( confirmRequests[ i ].requestID == request_id ) { status = confirmRequests[ i ].status; if ( CONFIRMATION_REQUEST_STATUS_PENDING != status) { // Send UI clear - if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == confirmRequests[ i ].status ) + if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) { sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, 0 ); } @@ -522,16 +521,16 @@ * @brief * The setConfirmationRequestStatus function sets the status of a confirmation request * @details Inputs: confirmRequests[] - * @details Outputs: confirmRequests[] status. - * @param request ID - * @param new status - * @return CONFIRMATION_REQUEST_STATUS_T + * @details Outputs: confirmRequests[]. + * @param request_id ID of confirmation being requested + * @param status Status to set for given confirmation (open, close, reject) + * @return none *************************************************************************/ void setConfirmationRequestStatus( GENERIC_CONFIRM_ID_T request_id, CONFIRMATION_REQUEST_STATUS_T status ) { U08 i; - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { if ( confirmRequests[ i ].requestID == request_id ) { @@ -546,18 +545,19 @@ * The addConfirmationRequest function sends a confirmation request to UI * @details Inputs: confirmRequests[] * @details Outputs: confirmRequests[] new added. - * @param request_id - confirm id / type - * @param request_type - confirm command + * @param request_id ID of confirmation being requested + * @param request_type Type of confirmation being requested (open, close, reject) + * @param reject_Reason Reason for reject if type is reject * @return request ID - will be non-zero if added *************************************************************************/ GENERIC_CONFIRM_ID_T addConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) { U08 i; GENERIC_CONFIRM_ID_T new_id = GENERIC_CONFIRM_ID_NONE; - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) { - if ( confirmRequests[ i ].status == CONFIRMATION_REQUEST_STATUS_UNUSED ) + if ( CONFIRMATION_REQUEST_STATUS_UNUSED == confirmRequests[ i ].status ) { // Save the confirmation request info confirmRequests[ i ].requestID = request_id; @@ -566,7 +566,6 @@ confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; new_id = request_id; sendConfirmationRequest( request_id, request_type, reject_reason ); - break; } } Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rceeba51c01b896855eb03ab81281a2b0f48c75d2 -r2fa2467ff29d05346bcb1586f2ed339f34d853b2 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision ceeba51c01b896855eb03ab81281a2b0f48c75d2) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 2fa2467ff29d05346bcb1586f2ed339f34d853b2) @@ -522,7 +522,8 @@ break; case ALARM_USER_ACTION_END_TREATMENT: - initiateAlarmAction( ALARM_ACTION_END_TREATMENT ); + // Send message to UI to get user confirmation to end treatment - action initiated only upon receipt of user confirmation from UI + addConfirmationRequest( GENERIC_CONFIRM_ID_TREATMENT_END, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0 ); break; case ALARM_USER_ACTION_ACK: @@ -819,6 +820,12 @@ alarmPrimaryAudioCurrentLG.data = getIntADCVoltageConverted( INT_ADC_PRIMARY_ALARM_CURRENT_LG ); alarmBackupAudioCurrent.data = getFPGABackupAlarmAudioCurrent(); + // Check for user confirmation of end treatment alarm response + if ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == getConfirmationRequestStatus( GENERIC_CONFIRM_ID_TREATMENT_END ) ) + { + initiateAlarmAction( ALARM_ACTION_END_TREATMENT ); + } + // TODO - Check current vs. expected audio output } Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r4c8fb9738f785e8c786e8323d7327aa11d18ceb9 -r2fa2467ff29d05346bcb1586f2ed339f34d853b2 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 4c8fb9738f785e8c786e8323d7327aa11d18ceb9) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 2fa2467ff29d05346bcb1586f2ed339f34d853b2) @@ -766,10 +766,8 @@ { if ( TRUE == didTimeout( timeOfLastDGCheckIn, DG_COMM_TIMEOUT_IN_MS ) ) { -#ifndef RUN_WITHOUT_DG activateAlarmNoData( ALARM_ID_DG_COMM_TIMEOUT ); dgIsCommunicating = FALSE; -#endif } } else // Otherwise clear the alarm Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa -r2fa2467ff29d05346bcb1586f2ed339f34d853b2 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2fa2467ff29d05346bcb1586f2ed339f34d853b2) @@ -3317,10 +3317,10 @@ * The sendConfirmationRequest function sends a confirmation request to UI * @details Inputs: none * @details Outputs: none - * @param request ID - * @param request type - * @param reject reason - * @return request ID - will be non-zero if sent + * @param request_id ID of confirmation being requested + * @param request_type Type of confirmation being requested + * @param reject_reason Reason Reason for reject if type is reject + * @return none *************************************************************************/ void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) {