Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r49533d4870aa10c1b20406dd5c013567fe854694 -r23ceb0a80986f0d4e61ba366e6d9691e57c4b08b --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 49533d4870aa10c1b20406dd5c013567fe854694) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 23ceb0a80986f0d4e61ba366e6d9691e57c4b08b) @@ -706,6 +706,8 @@ transitionToBloodPrime(); + // TODO DMC Save Last Treatment Time + return result; } Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r22cab5beebd48faf29e78c5003b0bdd0a32748e8 -r23ceb0a80986f0d4e61ba366e6d9691e57c4b08b --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 22cab5beebd48faf29e78c5003b0bdd0a32748e8) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 23ceb0a80986f0d4e61ba366e6d9691e57c4b08b) @@ -198,7 +198,8 @@ alarmStatus.noClear = FALSE; alarmStatus.noResume = FALSE; alarmStatus.noRinseback = FALSE; - alarmStatus.noEndTreatment = FALSE; + alarmStatus.noEndTreatment = FALSE; + alarmStatus.noBloodRecirc = FALSE; alarmStatus.noDialRecirc = FALSE; alarmStatus.ok = FALSE; @@ -572,6 +573,19 @@ /*********************************************************************//** * @brief + * The isBloodRecircBlocked function determines whether any currently + * active alarm is blocking blood re-circulation. + * @details Inputs: alarmStatus + * @details Outputs: none + * @return TRUE if any active alarm prevents blood re-circulation, FALSE if not + *************************************************************************/ +BOOL isBloodRecircBlocked( void ) +{ + return alarmStatus.noBloodRecirc; +} + +/*********************************************************************//** + * @brief * The isDialysateRecircBlocked function determines whether any currently * active alarm is blocking dialysate re-circulation. * @details Inputs: alarmStatus @@ -754,6 +768,7 @@ ALARM_ID_T a; BOOL faultsActive = FALSE; BOOL dialysateRecircBlocked = FALSE; + BOOL bloodRecircBlocked = FALSE; // Update FIFOs and sub-ranks per active alarms table - for alarm ranking purposes to determine "top" alarm for ( a = ALARM_ID_NO_ALARM; a < NUM_OF_ALARM_IDS; a++ ) @@ -797,6 +812,11 @@ { dialysateRecircBlocked = TRUE; } + // Track whether any active alarms prevent blood re-circulation so far + if ( TRUE == ALARM_TABLE[ a ].alarmNoBloodRecirc ) + { + bloodRecircBlocked = TRUE; + } } } @@ -805,6 +825,7 @@ alarmStatus.alarmTop = alarmPriorityFIFO[ highestPriority ].alarmID; alarmStatus.topAlarmConditionDetected = alarmIsDetected[ alarmStatus.alarmTop ]; alarmStatus.systemFault = faultsActive; + alarmStatus.noBloodRecirc = bloodRecircBlocked; alarmStatus.noDialRecirc = dialysateRecircBlocked; } Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r23ad90c3d5f08e67a1142a68c73d79fedb752da9 -r23ceb0a80986f0d4e61ba366e6d9691e57c4b08b --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 23ad90c3d5f08e67a1142a68c73d79fedb752da9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 23ceb0a80986f0d4e61ba366e6d9691e57c4b08b) @@ -6997,7 +6997,6 @@ U32 currentMessage; U32 totalMessages; U32 payloadLength; - BOOL status = FALSE; U08* payloadPtr = message->payload; @@ -7021,6 +7020,72 @@ /*********************************************************************//** * @brief +* The handleUIServiceModeRequest function handles a request to enter service +* mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleUIServiceModeRequest( MESSAGE_T *message ) +{ + BOOL status = FALSE; + HD_OP_MODE_T currentMode = getCurrentOperationMode(); + REQUEST_REJECT_REASON_CODE_T reject; + + if ( 0 == message->hdr.payloadLen ) + { + if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) + { + status = TRUE; + requestNewOperationMode( MODE_SERV ); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_TREATMENT_IN_PROGRESS; + } + } + else + { + reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); + sendUIServiceModeResponse( status, (U32)reject ); +} + +/*********************************************************************//** + * @brief + * The sendUIServiceModeResponse function sends out the HD response to a + * UI request to go to service mode. + * @details Inputs: none + * @details Outputs: Service mode request response msg constructed and queued + * @param accepted TRUE if request was accepted, FALSE if not + * @param rejCode Reject reason code explaining why request was rejected + * @return none + *************************************************************************/ +void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_RESPONSE_SERVICE_MODE_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejCode, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** +* @brief * The handleGetHDUsageInfoRecord function handles a request to get the HD * usage information record. * @details Inputs: none @@ -7121,4 +7186,54 @@ return result; } +/*********************************************************************//** +* @brief +* The handleSetBloodLeak2EmbeddedMode function handles a request to set the HD +* blood leak to embedded mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetBloodLeak2EmbeddedMode( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = testSetBloodLeak2EmbeddedMode(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetBloodEmbeddedModeCommand function handles a request to set the HD +* blood leak to embedded mode command. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetBloodEmbeddedModeCommand( MESSAGE_T* message ) +{ + U08 command; + + BOOL result = FALSE; + + // verify payload length + if ( sizeof(U08) == message->hdr.payloadLen ) + { + memcpy(&command, message->payload, sizeof(U08)); + + result = testSetBloodLeakEmbeddedModeCommand( command ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/