Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r24c447c3ee627c242fae1ce9c74d2b4d4a09e8c0 -r5cb24bbf95be6308a1d65ae15f57567983b56b40 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 24c447c3ee627c242fae1ce9c74d2b4d4a09e8c0) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5cb24bbf95be6308a1d65ae15f57567983b56b40) @@ -8,7 +8,7 @@ * @file SystemCommMessages.c * * @author (last) Michael Garthwaite -* @date (last) 31-Jul-2023 +* @date (last) 15-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 @@ -5448,6 +5502,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingCapacityOverride( payload.state.f32 ); @@ -8339,4 +8394,36 @@ 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 ); +} + /**@}*/