Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r3325bb3ddb5961167139a9db37b7098083b7b83d -rd4f40c48a728c866c24bf44a59ff8ddd1e244ca1 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3325bb3ddb5961167139a9db37b7098083b7b83d) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d4f40c48a728c866c24bf44a59ff8ddd1e244ca1) @@ -4650,4 +4650,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 ); +} + /**@}*/