Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rc7ea3969643ead419cbfcd34c3cb203c45bcad71 -re58e3385eaf5e920335f963937b2e9f654a32cfe --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c7ea3969643ead419cbfcd34c3cb203c45bcad71) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e58e3385eaf5e920335f963937b2e9f654a32cfe) @@ -4652,4 +4652,65 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** + * @brief + * The handleTestDGGetLoadCellsTareValues function handles a request to + * get the load cells tare values. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGGetLoadCellsTareValues( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SEND_LOAD_CELLS_TARE_VALUES; + msg.hdr.payloadLen = sizeof( F32 ) * NUM_OF_LOAD_CELLS; + + getLoadCellsTareValues( payloadPtr ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + status = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGSetLoadCellsTareValues function handles a request to + * set the load cells tare values. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGSetLoadCellsTareValues( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( ( sizeof( F32 ) * NUM_OF_LOAD_CELLS ) == message->hdr.payloadLen ) + { + status = TRUE; + + F32 payload[ NUM_OF_LOAD_CELLS ]; + + memcpy( &payload, message->payload, sizeof( F32 ) * NUM_OF_LOAD_CELLS ); + + setLoadCellsTareValues( (U08*)&payload ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/