Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r96b5f969bbba7b44593c85c8ac003be0a2d87151 -ra8ee65f27d84c7ae435b8bbae6a1d82a51e804f1 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 96b5f969bbba7b44593c85c8ac003be0a2d87151) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a8ee65f27d84c7ae435b8bbae6a1d82a51e804f1) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Dara Navaei -* @date (last) 15-Feb-2023 +* @author (last) Michael Garthwaite +* @date (last) 20-Mar-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -484,7 +484,7 @@ // create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_VERSION; + msg.hdr.msgID = MSG_ID_DG_VERSION_REPONSE; msg.hdr.payloadLen = sizeof( DG_VERSIONS_T ); if ( message->hdr.payloadLen == sizeof( U08 ) + sizeof( U08 ) + sizeof( U08 ) + sizeof( U16 ) + sizeof( U32 ) ) @@ -526,7 +526,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_SERIAL_NUMBER; + msg.hdr.msgID = MSG_ID_DG_SERIAL_NUMBER_RESPONSE; // Add 1 byte for null terminator msg.hdr.payloadLen = MAX_TOP_LEVEL_SN_CHARS + 1; @@ -1660,30 +1660,29 @@ /*********************************************************************//** * @brief - * The handleCpldStatusRequest function handles a CPLD Status request message. + * The handleReceiveChemFlushSampleResultsFromHD function handles receiving + * the chemical disinfect sample flush results from HD. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleCpldStatusRequest( MESSAGE_T *message ) +void handleReceiveChemFlushSampleResultsFromHD( MESSAGE_T *message ) { - MESSAGE_T msg; - CPLD_STATUS_T payload; - U08 *payloadPtr = msg.payload; + BOOL status = FALSE; - // populate payload - getCPLDStatus( &payload ); - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_CPLD_STATUS; - msg.hdr.payloadLen = sizeof( CPLD_STATUS_T ); + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 result; - // fill message payload - memcpy( payloadPtr, &payload, sizeof( CPLD_STATUS_T ) ); + memcpy( &result, message->payload, 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_DG_BROADCAST, ACK_NOT_REQUIRED ); + setChemicalDisinfectFlushSampleResult( result ); + + status = TRUE; + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); } @@ -4268,7 +4267,7 @@ memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); if ( FALSE == payload.reset ) { - result = testSetIntegratedVolumeOverride( payload.state.u32 ); + result = testSetIntegratedVolumeOverride( payload.state.f32 ); } else { @@ -4436,4 +4435,35 @@ } #endif +/*********************************************************************//** + * @brief + * The handleTestDGSetDialysateMixingRatios function handles a request + * to set the dialysate mixing ratios. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGSetDialysateMixingRatios( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen >= ( 2 * sizeof(F32) ) ) + { + F32 acidMixingRatio = 0.0F; + F32 bicarbMixingRatio = 0.0F; + + memcpy(&acidMixingRatio, payloadPtr, sizeof(F32)); + payloadPtr += sizeof(F32); + + memcpy(&bicarbMixingRatio, payloadPtr, sizeof(F32)); + + status = testSetDialysateMixingRatios( acidMixingRatio, bicarbMixingRatio ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/