Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r056ef172979282cacadfe7a58842821ea431cc50 -r326e3597e1555ef2ac4978f58786e7ce638b1287 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 056ef172979282cacadfe7a58842821ea431cc50) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 326e3597e1555ef2ac4978f58786e7ce638b1287) @@ -115,7 +115,7 @@ /// Blood flow slow read timeout alarm persistence. #define BLOOD_FLOW_SLOW_READ_TO_PERSIST ( MS_PER_SECOND * 3 ) -#define DFM_SENSOR_CONNECTED_STATUS 0x02 ///< Blood flow meter connected status. +#define BFM_SENSOR_CONNECTED_STATUS 0x00 ///< Blood flow meter connected status. #define BFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Blood flow meter NVM parameter status. #define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. @@ -455,7 +455,7 @@ U08 flowStatus = getFPGABloodFlowMeterStatus(); #ifndef DISABLE_PUMP_FLOW_CHECKS - if ( flowStatus != DFM_SENSOR_CONNECTED_STATUS ) + if ( flowStatus != BFM_SENSOR_CONNECTED_STATUS ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BLOOD_FLOW_STATUS_SELF_TEST_FAILURE, (U32)flowStatus ); } Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r5545719a6bde1e93991c25918d975024b44c1b43 -r326e3597e1555ef2ac4978f58786e7ce638b1287 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5545719a6bde1e93991c25918d975024b44c1b43) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 326e3597e1555ef2ac4978f58786e7ce638b1287) @@ -117,7 +117,7 @@ /// Dialysate flow slow read timeout alarm persistence. #define DIALYSATE_FLOW_SLOW_READ_TO_PERSIST ( MS_PER_SECOND * 3 ) -#define DFM_SENSOR_CONNECTED_STATUS 0x02 ///< Dialysate flow meter connected status. +#define DFM_SENSOR_CONNECTED_STATUS 0x00 ///< Dialysate flow meter connected status. #define DFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Dialysate flow meter NVM parameter corrupt status. #define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -ra9160f295f6baf4fad4a8e2a739782f6df7d177a -r326e3597e1555ef2ac4978f58786e7ce638b1287 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision a9160f295f6baf4fad4a8e2a739782f6df7d177a) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 326e3597e1555ef2ac4978f58786e7ce638b1287) @@ -1265,6 +1265,10 @@ handleDGCmdResp( message ); break; + case MSG_ID_UI_HD_SET_RTC_REQUEST: + handleUIClockSyncRequest( message ); + break; + case MSG_ID_DG_POST_FINAL_TEST_RESULT: handleDGPOSTFinalResult( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra9160f295f6baf4fad4a8e2a739782f6df7d177a -r326e3597e1555ef2ac4978f58786e7ce638b1287 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a9160f295f6baf4fad4a8e2a739782f6df7d177a) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 326e3597e1555ef2ac4978f58786e7ce638b1287) @@ -1046,27 +1046,72 @@ * The handleDGCmdResp function handles a DG command response message. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. - * @param messagePtr pointer to the message to handle. + * @param message pointer to the message to handle. * @return none *************************************************************************/ -void handleDGCmdResp( MESSAGE_T *messagePtr ) +void handleDGCmdResp( MESSAGE_T *message ) { BOOL result = FALSE; - if ( messagePtr->hdr.payloadLen == sizeof( DG_CMD_RESPONSE_T ) ) + if ( message->hdr.payloadLen == sizeof( DG_CMD_RESPONSE_T ) ) { DG_CMD_RESPONSE_T dgCmdResponse; result = TRUE; - memcpy( &dgCmdResponse, messagePtr->payload, sizeof( DG_CMD_RESPONSE_T ) ); + memcpy( &dgCmdResponse, message->payload, sizeof( DG_CMD_RESPONSE_T ) ); handleDGCommandResponse( &dgCmdResponse ); } - sendAckResponseMsg( (MSG_ID_T)messagePtr->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, result ); + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, result ); } /*********************************************************************//** * @brief + * The handleUIClockSyncRequest function handles a UI clock sync message. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for transmit. + * @param messagePtr pointer to the message to handle. + * @return none + *************************************************************************/ +void handleUIClockSyncRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + U32 rejReason = REQUEST_REJECT_REASON_NONE; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + if ( message->hdr.payloadLen == sizeof( U32 ) ) + { + U32 epoch; + + memcpy( &epoch, message->payload, sizeof( U32 ) ); + result = setRTCEpoch( epoch ); + if ( FALSE == result ) + { + rejReason = REQUEST_REJECT_REASON_INVALID_DATE_OR_TIME; + } + } + else + { + rejReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Create a response message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_UI_SET_RTC_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + memcpy( payloadPtr, &result, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejReason, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); +} + +/*********************************************************************//** + * @brief * The handleDGOpMode function handles a DG broadcast of its current mode. * @details Inputs: none * @details Outputs: message handled, response constructed and queued for transmit. Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -ra9160f295f6baf4fad4a8e2a739782f6df7d177a -r326e3597e1555ef2ac4978f58786e7ce638b1287 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a9160f295f6baf4fad4a8e2a739782f6df7d177a) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 326e3597e1555ef2ac4978f58786e7ce638b1287) @@ -275,6 +275,9 @@ // MSG_ID_DG_COMMAND_RESPONSE void handleDGCmdResp( MESSAGE_T *messagePtr ); + +// MSG_ID_UI_HD_SET_RTC_REQUEST: +void handleUIClockSyncRequest( MESSAGE_T *message ); // MSG_ID_DG_OP_MODE void handleDGOpMode( MESSAGE_T *message );