Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r24c447c3ee627c242fae1ce9c74d2b4d4a09e8c0 -r4d0c621f5994e1de8bf7d3337678f7835292ce73 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 24c447c3ee627c242fae1ce9c74d2b4d4a09e8c0) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 4d0c621f5994e1de8bf7d3337678f7835292ce73) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Michael Garthwaite -* @date (last) 31-Jul-2023 +* @author (last) Bill Bracken +* @date (last) 22-Aug-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -27,6 +27,7 @@ #include "ConsumableSelfTest.h" #include "Fans.h" #include "FPGA.h" +#include "Integrity.h" #include "ModeStandby.h" #include "ModeInitPOST.h" #include "OperationModes.h" @@ -3029,6 +3030,27 @@ /*********************************************************************//** * @brief + * The handlePostTxNextCmd function handles a post-treatment next request + * message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handlePostTxNextCmd( MESSAGE_T *message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + requestPostTxNext(); + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief * The sendTreatmentRecircCmdResponse function constructs a treatment re-circulation * user action response to the UI and queues the msg for transmit on the appropriate * CAN channel. @@ -3061,6 +3083,38 @@ /*********************************************************************//** * @brief + * The sendPostTxNextCmdResponse function constructs a post-treatment next + * command response to the UI and queues the msg for transmit on the appropriate + * CAN channel. + * @details Inputs: none + * @details Outputs: Post-treatment next command response msg constructed and queued. + * @param accepted T/F - was request accepted? + * @param rejReason reason why request was rejected (or zero if accepted) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendPostTxNextCmdResponse( BOOL accepted, U32 rejReason ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_POST_TX_NEXT_CMD_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejReason, 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_UI, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The handleTreatmentEndCmd function handles a treatment end user action command * message from the UI. * @details Inputs: none @@ -6144,7 +6198,6 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; BOOL result = FALSE; -#ifndef _RELEASE_ // Verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { @@ -6158,7 +6211,6 @@ result = testResetValvesCurrentOverride( payload.index ); } } -#endif // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); @@ -8339,4 +8391,68 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** + * @brief + * The handleTestHDRAMStatusOverrideRequest function handles a request to + * override the RAM status register. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDRAMStatusOverrideRequest( MESSAGE_T* message ) +{ + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetRAMStatusOverride( payload.index, payload.state.u32 ); + } + else + { + result = testResetRAMStatusOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestHDPendingACKOverrideRequest function handles a + * request to override pending ACKs. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDPendingACKOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetPendingACKOverride( payload.state.u32 ); + } + else + { + result = testResetPendingACKOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/