Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -re23087e0c17f6ea81d60641fdb52121a8dd5a099 -r27f3db92495948d4c1192421c1b0c20338c4a034 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e23087e0c17f6ea81d60641fdb52121a8dd5a099) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 27f3db92495948d4c1192421c1b0c20338c4a034) @@ -534,6 +534,34 @@ return result; } + +/*********************************************************************//** + * @brief + * The sendDGChangeValveSettingCommand function constructs a DG change valve + * setting message for DG and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG change valve setting msg constructed and queued. + * @param valveSettingCmd valve setting ID to change to + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGChangeValveSettingCommand( U32 valveSettingCmd ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CHANGE_VALVE_SETTING_CMD; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( payloadPtr, &valveSettingCmd, sizeof( U32 ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); + + return result; +} /*********************************************************************//** * @brief @@ -689,8 +717,11 @@ if ( messagePtr->hdr.payloadLen == sizeof( DG_CMD_RESPONSE_T ) ) { + DG_CMD_RESPONSE_T dgCmdResponse; + result = TRUE; - handleDGCommandResponse( messagePtr->payload ); + memcpy( &dgCmdResponse, messagePtr->payload, sizeof( DG_CMD_RESPONSE_T ) ); + handleDGCommandResponse( &dgCmdResponse ); } sendAckResponseMsg( (MSG_ID_T)messagePtr->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_DG, result ); @@ -3863,7 +3894,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestSetTreatmentParameter function handles a request to set * a specific treatment parameter value.