Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r4d53c13427bb2da28fea7bcba9974c2c787b5b13 -r782cbace651eebeccbbfd3e2f2b607436269ee7f --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 4d53c13427bb2da28fea7bcba9974c2c787b5b13) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 782cbace651eebeccbbfd3e2f2b607436269ee7f) @@ -8,7 +8,7 @@ * @file SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 17-Apr-2023 +* @date (last) 31-May-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -1606,7 +1606,7 @@ } // 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_2_HD, ACK_REQUIRED ); + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_REQUIRED ); } /*********************************************************************//** @@ -3773,6 +3773,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +#ifndef _RELEASE_ /*********************************************************************//** * @brief * The handleGetDGSoftwareConfigRecord function handles a request to get the DG @@ -3835,6 +3836,7 @@ // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +#endif /*********************************************************************//** * @brief @@ -4652,4 +4654,91 @@ 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 ) + { + F32 payload[ NUM_OF_LOAD_CELLS ]; + + status = TRUE; + + memcpy( &payload, message->payload, sizeof( F32 ) * NUM_OF_LOAD_CELLS ); + + setLoadCellsTareValues( (U08*)&payload ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGSetConductivitySensorCalTable function handles a request to + * set the conductivity sensor's calibration table. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGSetConductivitySensorCalTable( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( sizeof( CONDUCTIVITY_SENSOR_CAL_TABLE_T ) == message->hdr.payloadLen ) + { + CONDUCTIVITY_SENSOR_CAL_TABLE_T payload; + + memcpy( &payload, message->payload, sizeof( CONDUCTIVITY_SENSOR_CAL_TABLE_T ) ); + + testSetConductivitySensorCalibrationTable( &payload ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/