Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r7fe3d2932b501e323a6fb0eb47964b32da6798d9 -r782cbace651eebeccbbfd3e2f2b607436269ee7f --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 7fe3d2932b501e323a6fb0eb47964b32da6798d9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 782cbace651eebeccbbfd3e2f2b607436269ee7f) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Sean Nash -* @date (last) 30-Mar-2023 +* @author (last) Dara Navaei +* @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 ); } /*********************************************************************//** @@ -1815,6 +1815,19 @@ /*********************************************************************//** * @brief + * The setTesterStatusToLoggedOut function sets the status of the tester to + * logged out. + * @details Inputs: none + * @details Outputs: testerLoggedIn + * @return none + *************************************************************************/ +void setTesterStatusToLoggedOut( void ) +{ + testerLoggedIn = FALSE; +} + +/*********************************************************************//** + * @brief * The sendTestAckResponseMsg function constructs a simple response message for * a handled test message and queues it for transmit on the appropriate UART channel. * @details Inputs: none @@ -3760,6 +3773,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +#ifndef _RELEASE_ /*********************************************************************//** * @brief * The handleGetDGSoftwareConfigRecord function handles a request to get the DG @@ -3822,6 +3836,7 @@ // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +#endif /*********************************************************************//** * @brief @@ -4538,4 +4553,192 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** + * @brief + * The handleTestDGSetTestConfig function handles a request to set the + * test configuration. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGSetTestConfig( MESSAGE_T *message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof( TEST_CONFIG_PAYLOAD_T ) ) + { + TEST_CONFIG_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof( TEST_CONFIG_PAYLOAD_T ) ); + + if ( TRUE == payload.reset ) + { + status = resetTestConfig( (TEST_CONFIG_T)payload.config ); + } + else + { + status = setTestConfig( (TEST_CONFIG_T)payload.config ); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGGetTestConfig function handles a request to get the + * test configuration per request. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGGetTestConfig( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = sendTestConfigStatusToDialin(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGResetAllTestConfigs function handles a request to reset + * all of the test configurations. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGResetAllTestConfigs( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + result = resetAllTestConfigs(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGDialinCheckIn function handles check in from Dialin. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGDialinCheckIn( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + status = TRUE; + setDialinCheckInTimeStamp(); + } + + // respond to request + 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 ); +} + /**@}*/