Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra6fec5578295ef0bb7223376facb7d0cbd2c1209 -r9d40104500ae1c144a19b36b83a0515d32fb7fc9 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a6fec5578295ef0bb7223376facb7d0cbd2c1209) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 9d40104500ae1c144a19b36b83a0515d32fb7fc9) @@ -1133,24 +1133,26 @@ * @param current : Current of the valve * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastHDValves( U32 valve, U32 currentPosEnum, S16 currentPosCount, F32 current ) +BOOL broadcastHDValves() { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - HD_VALVES_T payload; + //HD_VALVE_DATA_T payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_HD_VALVES_DATA; - msg.hdr.payloadLen = sizeof( HD_VALVES_T ); + msg.hdr.payloadLen = sizeof( HD_VALVE_DATA_T ); - payload.valveID = valve; + /*payload.valveID = valve; + payload.state = state; payload.currentPosID = currentPosEnum; payload.currentPos = currentPosCount; - payload.current = current; + payload.nextPos = nextPosCount; + payload.current = current;*/ - memcpy( payloadPtr, &payload, sizeof( HD_VALVES_T ) ); + memcpy( payloadPtr, &valveData, sizeof( HD_VALVE_DATA_T ) ); // 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_BROADCAST, ACK_NOT_REQUIRED ); @@ -2400,6 +2402,31 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/************************************************************************* + * @brief + * The handleHomeHDValve function handles a request to home an HD valve + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleHomeHDValve( MESSAGE_T *message ) +{ + BOOL result; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + VALVE_T payload; + + memcpy( &payload, message->payload, sizeof(U32) ); + result = homeValve( payload ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /*********************************************************************//** * @brief * The handleTestHDValvesBroadcastIntervalOverrideRequest function handles \n @@ -2411,3 +2438,21 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHDValvesBroadcastIntervalOverrideRequest, testSetValvesDataPublishInterval, testResetValvesDataPublishInterval ) + + +void handleSetHDValvesPosition( MESSAGE_T *message ) +{ + BOOL result; + + if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) + { + LINEAR_F32_CAL_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(LINEAR_F32_CAL_PAYLOAD_T) ); + result = setDialInFlowCalibration( payload.gain, payload.offset ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); + +}