Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r41a41275952290677df1fb0d27db3f354be26dd8 -r43949bb09b178239911c2e46c6555bc31289090f --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 41a41275952290677df1fb0d27db3f354be26dd8) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 43949bb09b178239911c2e46c6555bc31289090f) @@ -3284,18 +3284,22 @@ // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_SERVICE_SCHEDULE_DATA; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ); if ( 0 == message->hdr.payloadLen ) { + U32 test = 0; // Fill message payload memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); + test = service.lastServiceEpochDate + service.serviceIntervalSeconds; + memcpy( payloadPtr, &test, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); + test = dgData.dgServiceRecord.lastServiceEpochDate + dgData.dgServiceRecord.serviceIntervalSeconds; + memcpy( payloadPtr, &test, sizeof( U32 ) ); + //memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer @@ -3411,8 +3415,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; - // The payload length is U32 Request ID, U32 Type + msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &status, sizeof( U32 ) ); @@ -3421,7 +3424,14 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_NOT_REQUIRED ); } -// MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL +/*********************************************************************//** + * @brief + * The sendDGStopActiveCoolModeCommand function sends a request to stop + * active cool mode command + * @details Inputs: none + * @details Outputs: none + * @return TRUE if the command was serialized successfully + *************************************************************************/ BOOL sendDGStopActiveCoolModeCommand( void ) { BOOL result; @@ -3430,7 +3440,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL; + msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( msg.payload, &start, sizeof( BOOL ) ); @@ -3441,15 +3451,24 @@ return result; } -// MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST +/*********************************************************************//** + * @brief + * The sendDGStartStopDGROPermeateSampleModeCommand function sends a request + * to start or stop RO permeate sample mode command + * @details Inputs: none + * @details Outputs: none + * @param start TRUE to star the RO permeate sample mode and FALSE to stop + * the RO permeate sample mode + * @return TRUE if the command was serialized successfully + *************************************************************************/ BOOL sendDGStartStopDGROPermeateSampleModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST; + msg.hdr.msgID = MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST; msg.hdr.payloadLen = sizeof( BOOL ); memcpy( msg.payload, &start, sizeof( BOOL ) ); @@ -3460,7 +3479,48 @@ return result; } +/*********************************************************************//** + * @brief + * The sendRequestROPermeateSampleCollectionToDG function sends a request + * to collect RO permeate sample to DG + * @details Inputs: none + * @details Outputs: none + * @param status which could be dispense or cancel + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendRequestROPermeateSampleCollectionToDG( U32 status ) +{ + BOOL result; + MESSAGE_T msg; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_RO_PERMEATE_SAMPLE_DISPENSE_REQUEST_TO_DG; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( msg.payload, &status, 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleReceiveROPermeateSampleReadyToDispenseFromDG function receives + * the signal from DG that it is ready to dispnese more in RO permeate sample + * mode + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void handleReceiveROPermeateSampleReadyToDispenseFromDG( void ) +{ + signalROPermeateSampleDGReadyToDispense(); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/