Index: firmware/App/HDCommon.h =================================================================== diff -u -r340ca3700bbc4235d85d82864597fe17ab4b557a -rd5b22405ec6269a9fc9f56f8a27651b71a878282 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 340ca3700bbc4235d85d82864597fe17ab4b557a) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision d5b22405ec6269a9fc9f56f8a27651b71a878282) @@ -71,6 +71,8 @@ // #define DISABLE_BATT_COMM 1 // Disable battery communication. #define SKIP_AIR_BUBBLE_CHECK 1 // Skip air bubble detector self-test. #define DISABLE_OCCLUSION_SELF_TEST 1 // Skip occlusion sensor self-test. + #define SKIP_CARTRIDGE_REMOVAL 1 // Skip cartridge removal check + #define SKIP_EMPTY_RES_CHECK 1 // Skip reservoir empty check #include #include Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r6dcc3d91f1f6095d6d3a722c2e3c2074d69be2a5 -rd5b22405ec6269a9fc9f56f8a27651b71a878282 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6dcc3d91f1f6095d6d3a722c2e3c2074d69be2a5) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d5b22405ec6269a9fc9f56f8a27651b71a878282) @@ -23,14 +23,10 @@ #include "AlarmLamp.h" #include "Buttons.h" #include "ConsumableSelfTest.h" -#include "DGInterface.h" #include "FPGA.h" -#include "ModePreTreat.h" #include "ModeStandby.h" -#include "ModeTreatment.h" #include "ModeTreatmentParams.h" #include "OperationModes.h" -#include "PresOccl.h" #include "RTC.h" #include "SampleWater.h" #include "SafetyShutdown.h" @@ -39,7 +35,6 @@ #include "TreatmentEnd.h" #include "TreatmentRecirc.h" #include "Utilities.h" -#include "Valves.h" #include "WatchdogMgmt.h" /** @@ -543,7 +538,108 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; +} + +/*********************************************************************//** + * @brief + * The handlePatientDisconnectionConfirmCmd function handles user confirms + * patient disconnection. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none. + *************************************************************************/ +void handlePatientDisconnectionConfirmCmd( MESSAGE_T *message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + signalUserConfirmPatientDisconnection(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } + +/*********************************************************************//** + * @brief + * The handleDisposableRemovalConfirmCmd function handles user confirms + * disposable removal. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none. + *************************************************************************/ +void handleDisposableRemovalConfirmCmd( MESSAGE_T *message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + signalUserConfirmDisposableRemoval(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); +} + +/*********************************************************************//** + * @brief + * The sendDisposableRemovalConfirmResponse function constructs a disposable + * removal confirm user action response to the UI and queues the msg for + * transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Disposable removal confirm response msg constructed and queued. + * @param accepted T/F - was disposable removal confirm request accepted? + * @param reason reason why request was rejected (or zero if accepted) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDisposableRemovalConfirmResponse( BOOL accepted, U32 reason ) +{ + return sendUIResponseMsg( MSG_ID_HD_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE, accepted, reason ); +} + +/*********************************************************************//** + * @brief + * The handleUITreatmentLogDataRequest function handles UI treatment log data request. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none. + *************************************************************************/ +void handleUITreatmentLogDataRequest( MESSAGE_T *message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + handleTreatmentLogDataRequest(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); +} + +/*********************************************************************//** + * @brief + * The sendTreatmentLogData function constructs a treatment log data message + * for UI and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Treatment log data msg constructed and queued. + * @param logDataPtr treatment log data record pointer + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendTreatmentLogData( BOOL accepted, U32 reason, TREATMENT_LOG_DATA_PAYLOAD_T *logDataPtr ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( TREATMENT_LOG_DATA_PAYLOAD_T ); + + memcpy( payloadPtr, &accepted, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &reason, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, logDataPtr, sizeof( TREATMENT_LOG_DATA_PAYLOAD_T ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); +} /*********************************************************************//** * @brief @@ -1506,6 +1602,30 @@ /*********************************************************************//** * @brief + * The broadcastPostTreatmentState function constructs a post treatment state msg + * to be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: post-treatment state msg constructed and queued + * @param postTreatmentSubMode post-treatment state sub-mode + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastPostTreatmentState( U32 postTreatmentSubMode ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_POST_TREATMENT_STATE; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( payloadPtr, &postTreatmentSubMode, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); +} + +/*********************************************************************//** + * @brief * The broadcastPreTreatmentState function constructs a pre-treatment state msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -3049,7 +3169,6 @@ /*********************************************************************//** * @brief * The sendDebugDataToUI function sends debug string to the UI for logging. - * @details * @details Inputs: none * @details Outputs: Message constructed and queued for transmit * @param str Pointer to debug string