Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 -r3633c7c348e95b11175dfb4a4a183bdb6cd24478 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3633c7c348e95b11175dfb4a4a183bdb6cd24478) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Bill Bracken -* @date (last) 22-Aug-2022 +* @author (last) Darren Cox +* @date (last) 13-Sep-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -889,24 +889,26 @@ /*********************************************************************//** * @brief - * The handleSetHDStandbyDisinfectSubmode function handles setting the + * The handleSetHDStandbyDisinfectSubmodeRequest function handles setting the * standby submode to wait for disisnfect state. - * @details Inputs: none + * @details Inputs: 1=initiate, 0=cancel * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDStandbyDisinfectSubmodeRequest( MESSAGE_T *message ) { - BOOL result = FALSE; + U32 cmd; - // The payload should be 0 in this case because there is mode in this command - if ( 0 == message->hdr.payloadLen ) + if ( sizeof( U32 ) == message->hdr.payloadLen ) { - signalInitiateStandbyDisinfectSubmode(); + memcpy( &cmd, &message->payload[0], sizeof( U32 ) ); + signalInitiateStandbyDisinfectSubmode( cmd ); } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); + else + { + handleSetHDStandbyDisinfectSubmodeResponse( FALSE, REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT ); + } } /*********************************************************************//** @@ -7001,15 +7003,26 @@ { BOOL status = FALSE; HD_OP_MODE_T currentMode = getCurrentOperationMode(); + DG_OP_MODE_T currentDGMode = getDGOpMode(); REQUEST_REJECT_REASON_CODE_T reject; if ( 0 == message->hdr.payloadLen ) { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { - status = TRUE; + requestNewOperationMode( MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; + + if ( (DG_MODE_STAN == currentDGMode) || (DG_MODE_FAUL == currentDGMode) ) + { + status = TRUE; + cmdSetDGToServiceMode(); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } } else { @@ -7287,4 +7300,28 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The sendDGServiceModeRequest function constructs a service mode request msg + * to the DG and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG Service mode request msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGServiceModeRequest() +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_DG_SERVICE_MODE; + msg.hdr.payloadLen = 0; + + // 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; +} + /**@}*/