Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5e8f96e11c797bddeddfc009c87f20df3b7a8664 -re2e31bba8ccc7b60ba6036377799c71f9ceee63f --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5e8f96e11c797bddeddfc009c87f20df3b7a8664) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e2e31bba8ccc7b60ba6036377799c71f9ceee63f) @@ -23,6 +23,7 @@ #include "Compatible.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" +#include "CPLD.h" #include "Fans.h" #include "FlowSensors.h" #include "FPGA.h" @@ -828,6 +829,38 @@ } /*********************************************************************//** +<<<<<<< HEAD + * @brief + * The handleDGScheduledRunsRequest function handles a request for DG + * scheduled runs information. + * @details Inputs: none + * @details Outputs: message handled, response constructed and queued for + * transmit. + * @return none + *************************************************************************/ +void handleDGScheduledRunsRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + DG_SCHEDULED_RUN_RECORD_T scheduledService; + + // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record + // has been already checked in POST + getNVRecord2Driver( GET_SRR_RECORD, (U08*)&scheduledService, sizeof( DG_SCHEDULED_RUN_RECORD_T ), 0, ALARM_ID_NO_ALARM ); + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_SCHEDULED_RUNS_DATA; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ); + + // TODO this message is for Phase 1B. + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_UI, ACK_REQUIRED ); +} + +/*********************************************************************//** +======= +>>>>>>> staging * @brief * The handleStartStopDGFlush function handles a request to start or stop * DG flush mode. @@ -1434,6 +1467,44 @@ } /*********************************************************************//** +* @brief +* The handleServiceModeRequest function handles a request to enter service +* mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleServiceModeRequest( MESSAGE_T *message ) +{ + BOOL status = FALSE; + DG_OP_MODE_T currentMode = getCurrentOperationMode(); + REQUEST_REJECT_REASON_CODE_T reject; + + if ( 0 == message->hdr.payloadLen ) + { + if ( ( DG_MODE_STAN == currentMode ) || ( DG_MODE_FAUL == currentMode ) ) + { + status = TRUE; + requestNewOperationMode( DG_MODE_SERV ); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } + } + else + { + reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); + sendServiceModeResponse( status, (U32)reject ); +} + +/*********************************************************************//** * @brief * The handleHDRequestDGUsageInfo function handles a request for DG * usage information. @@ -1451,7 +1522,7 @@ // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_USAGE_DATA; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( BOOL ); + msg.hdr.payloadLen = sizeof( DG_USAGE_INFO_RECORD_T ); // Get the service record. There are no arrays of service to check and also, raise no alarm since the service record // has been already checked in POST @@ -1460,18 +1531,42 @@ if ( 0 == message->hdr.payloadLen ) { // Fill message payload - memcpy( payloadPtr, &usageInfo.lastHeatDisDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &usageInfo.lastChemicalDisDateEpoch, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &usageInfo.isDisinfected, sizeof( BOOL ) ); + memcpy( payloadPtr, &usageInfo, sizeof( DG_USAGE_INFO_RECORD_T ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_2_HD, ACK_REQUIRED ); } +/*********************************************************************//** + * @brief + * The handleCpldStatusRequest function handles a CPLD Status request message. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleCpldStatusRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + CPLD_STATUS_T payload; + U08 *payloadPtr = msg.payload; + // populate payload + getCPLDStatus( &payload ); + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CPLD_STATUS; + msg.hdr.payloadLen = sizeof( CPLD_STATUS_T ); + + // fill message payload + memcpy( payloadPtr, &payload, sizeof( CPLD_STATUS_T ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); +} + + // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -3786,44 +3881,6 @@ } /*********************************************************************//** -* @brief -* The handleServiceModeRequest function handles a request to enter service -* mode. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleServiceModeRequest( MESSAGE_T *message ) -{ - BOOL status = FALSE; - DG_OP_MODE_T currentMode = getCurrentOperationMode(); - REQUEST_REJECT_REASON_CODE_T reject; - - if ( 0 == message->hdr.payloadLen ) - { - if ( ( DG_MODE_STAN == currentMode ) || ( DG_MODE_FAUL == currentMode ) ) - { - status = TRUE; - requestNewOperationMode( DG_MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; - } - else - { - reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; - } - } - else - { - reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); - sendServiceModeResponse( status, (U32)reject ); -} - -/*********************************************************************//** * @brief * The sendServiceModeResponse function sends out the DG response to a * UI request to go to service mode.