Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r6ba61903be56ce79582fc9a31e0927df4dafee08 -reb57e092118ff2f79ba7cb48c551bacd01ad8aef --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6ba61903be56ce79582fc9a31e0927df4dafee08) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision eb57e092118ff2f79ba7cb48c551bacd01ad8aef) @@ -8,28 +8,33 @@ * @file SystemCommMessages.c * * @author (last) Dara Navaei -* @date (last) 21-Oct-2022 +* @date (last) 21-Dec-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ -#include // for memcpy() +#include // for memcpy() #include "reg_system.h" #include "Accel.h" #include "Compatible.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" +#include "CPLD.h" #include "Fans.h" #include "FlowSensors.h" #include "FPGA.h" #include "Heaters.h" +#include "ModeChemicalDisinfect.h" +#include "ModeChemicalDisinfectFlush.h" #include "ModeFill.h" #include "ModeFlush.h" #include "ModeGenIdle.h" +#include "ModeHeatDisinfect.h" +#include "ModeHeatDisinfectActiveCool.h" #include "ModeInitPOST.h" #include "ModeStandby.h" #include "MsgQueues.h" @@ -828,6 +833,35 @@ } /*********************************************************************//** + * @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 ); +} + +/*********************************************************************//** * @brief * The handleStartStopDGFlush function handles a request to start or stop * DG flush mode. @@ -899,15 +933,16 @@ { BOOL result = FALSE; - if ( message->hdr.payloadLen == sizeof( U32 ) ) + if ( message->hdr.payloadLen == sizeof( DG_SWITCH_RSRVRS_CMD_T ) ) { - DG_RESERVOIR_ID_T reservoirID; - U32 resID; + DG_SWITCH_RSRVRS_CMD_T cmd; + memcpy( &cmd, message->payload, sizeof( DG_SWITCH_RSRVRS_CMD_T ) ); + + setActiveReservoirCmd( (DG_RESERVOIR_ID_T)cmd.reservoirID ); + setTrimmerHeaterUseLastDutyCycleStatus( cmd.useLastTrimmerHeaterDC ); + result = TRUE; - memcpy( &resID, message->payload, sizeof( U32 ) ); - reservoirID = (DG_RESERVOIR_ID_T)resID; - setActiveReservoirCmd( reservoirID ); } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); @@ -1352,6 +1387,41 @@ } /*********************************************************************//** +* @brief +* The handleStartStopDGChemicalDisinfectFlush function handles a request to start +* or stop DG chemical disinfect flush mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +BOOL handleStartStopDGChemicalDisinfectFlush( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(BOOL) ) + { + BOOL startingDGChemicalDisinfectFlush; + + memcpy( &startingDGChemicalDisinfectFlush, message->payload, sizeof(BOOL) ); + + if ( TRUE == startingDGChemicalDisinfectFlush ) + { + result = startDGChemicalDisinfectFlush(); + } + else + { + result = stopChemicalDisinfectFlush(); + } + } + + // Respond to request + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); + + return result; +} + +/*********************************************************************//** * @brief * The handleTestSetOpModeRequest function handles a request to set the * DG operation mode. @@ -1433,6 +1503,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. @@ -1450,7 +1558,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 @@ -1459,18 +1567,126 @@ 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 sendServiceModeResponse function sends out the DG response to a + * UI request to go to service mode. + * @details Inputs: none + * @details Outputs: Service mode request response msg constructed and queued + * @param accepted TRUE if request was accepted, FALSE if not + * @param rejCode Reject reason code explaining why request was rejected + * @return none + *************************************************************************/ +BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejCode, 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_DG_2_HD, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleSetDGServiceTime function sets the DG service time once the + * command is received from UI + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetDGServiceTime( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + result = setServiceTime(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_UI, result ); +} + +/************************************************************************* + * @brief + * The handleStartStopDGHeatDisinfectActiveCool function handles a request + * start or stop DG heat disinfect active cool mode. + * @details Inputs: none + * @details Outputs: message handled + * @param message: a pointer to the message to handle + * @return result + *************************************************************************/ +void handleStartStopDGHeatDisinfectActiveCool( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + BOOL startingDGHeatDisinfectActiveCool; + + memcpy( &startingDGHeatDisinfectActiveCool, message->payload, sizeof(U32) ); + + if ( TRUE == startingDGHeatDisinfectActiveCool ) + { + status = startDGHeatDisinfectActiveCool(); + } + else + { + status = stopDGHeatDisinfectActiveCool(); + } + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); +} + +/*********************************************************************//** + * @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 ******************** // *********************************************************************** @@ -2677,13 +2893,13 @@ result = TRUE; memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); - if ( ( BOOL )payload.state.u32 ) + if ( TRUE == ( BOOL )payload.state.u32 ) { requestConcentratePumpOn( ( CONCENTRATE_PUMPS_T )payload.index ); } else { - requestConcentratePumpOff( ( CONCENTRATE_PUMPS_T )payload.index ); + requestConcentratePumpOff( ( CONCENTRATE_PUMPS_T )payload.index, NO_PARK_CONC_PUMPS ); } } @@ -2949,23 +3165,24 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - status = receiveRecordFromDialin( NVDATAMGMT_CALIBRATION_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_CALIBRATION_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } - - /*********************************************************************//** * @brief * The handleGetDGCalibrationRecord function handles a request to get the DG @@ -3010,16 +3227,19 @@ U32 totalMessages; U32 payloadLength; - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); - status = receiveRecordFromDialin( NVDATAMGMT_SYSTEM_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + status = receiveRecordFromDialin( NVDATAMGMT_SYSTEM_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); @@ -3096,7 +3316,7 @@ U32 totalMessages; U32 payloadLength; - if ( 0 == message->hdr.payloadLen ) + if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) { memcpy(¤tMessage, payloadPtr, sizeof(U32)); payloadPtr += sizeof(U32); @@ -3372,6 +3592,7 @@ // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } + /*********************************************************************//** * The handleSetFansDutyCycleOverrideRequest function handles a * request to override the fans duty cycle. @@ -3508,7 +3729,7 @@ * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleTestHDCommunicationStatusOverrideRequest(MESSAGE_T *message) +void handleTestHDCommunicationStatusOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; BOOL result = FALSE; @@ -3565,6 +3786,101 @@ } /*********************************************************************//** +* The handleTestDGDrainPumpCurrentOverrideRequest function handles a +* request to override the drain pump measured current. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestDGDrainPumpCurrentOverrideRequest( 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 = testSetDrainPumpMeasuredCurrentOverride( payload.state.f32 ); + } + else + { + result = testResetDrainPumpMeasuredCurrentOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* The handleTestDGDrainPumpDirectionOverrideRequest function handles a +* request to override the drain pump measured direction. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestDGDrainPumpDirectionOverrideRequest( 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 = testSetDrainPumpMeasuredDirectionOverride( payload.state.u32 ); + } + else + { + result = testResetDrainPumpMeasuredDirectionOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* The handleTestDGValvesSensedStateOverrideRequest function handles a +* request to override the valves sensed state. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestDGValvesSensedStateOverrideRequest( 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 = testSetValveSensedStateOverride( payload.index, payload.state.u32 ); + } + else + { + result = testResetValveSensedStateOverride( payload.index ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** * @brief * The handleGetDGUsageInfoRecord function handles a request to get the DG * usage information record. @@ -3692,71 +4008,116 @@ /*********************************************************************//** * @brief -* The handleServiceModeRequest function handles a request to enter service -* mode. +* The handleTestDGNVRecordCRCOverride function handles a request to override +* the selected NV record's CRC. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ -void handleServiceModeRequest( MESSAGE_T *message ) +void handleTestDGNVRecordCRCOverride( MESSAGE_T *message ) { - BOOL status = FALSE; - DG_OP_MODE_T currentMode = getCurrentOperationMode(); - REQUEST_REJECT_REASON_CODE_T reject; + TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; + BOOL result = FALSE; - if ( 0 == message->hdr.payloadLen ) + // verify payload length + if ( sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) == message->hdr.payloadLen ) { - if ( ( DG_MODE_STAN == currentMode ) || ( DG_MODE_FAUL == currentMode ) ) + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); + result = testSetNVRecordCRCOverride( payload.index, (U16)payload.state.u32 ); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* The handleTestDGConcPumpParkStatusOverrideRequest function handles a +* request to override the parked status of a given concentrate pump. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestDGConcPumpParkStatusOverrideRequest( 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 ) { - status = TRUE; - requestNewOperationMode( DG_MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; + result = testSetConcentratePumpParkedOverride( payload.index, (U16)payload.state.u32 ); } else { - reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + result = testResetConcentratePumpParkedOverride( payload.index ); } } - else + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* The handleTestDGConcPumpParkFaultStatusOverrideRequest function handles a +* request to override the park faulted status of a given concentrate pump. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestDGConcPumpParkFaultStatusOverrideRequest( 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 ) { - reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_ARRAY_PAYLOAD_T ) ); + + if ( FALSE == payload.reset ) + { + result = testSetConcentratePumpParkCmdFaultedOverride( payload.index, (U16)payload.state.u32 ); + } + else + { + result = testResetConcentratePumpParkCmdFaultedOverride( payload.index ); + } } - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); - sendServiceModeResponse( status, (U32)reject ); + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** - * @brief - * The sendServiceModeResponse function sends out the DG response to a - * UI request to go to service mode. - * @details Inputs: none - * @details Outputs: Service mode request response msg constructed and queued - * @param accepted TRUE if request was accepted, FALSE if not - * @param rejCode Reject reason code explaining why request was rejected - * @return none - *************************************************************************/ -BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ) +* The handleTestDGConcPumpParkCommandRequest function handles a command +* to park a given concentrate pump. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleTestDGConcPumpParkCommandRequest( MESSAGE_T *message ) { - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; + U32 pumpIdx; + BOOL result = FALSE; - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST; - msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + // verify payload length + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + memcpy( &pumpIdx, message->payload, sizeof( U32 ) ); - memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); - payloadPtr += sizeof( BOOL ); - memcpy( payloadPtr, &rejCode, sizeof( U32 ) ); + result = testSetConcentratePumpParkCommand( pumpIdx ); + } - // 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_DG_2_HD, ACK_REQUIRED ); - - return result; + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } /*********************************************************************//** @@ -3823,4 +4184,99 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestDGROPumpFeedbackVoltageOverrideRequest function handles a request + * to override the gen idle state publish interval + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGROPumpFeedbackVoltageOverrideRequest( 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 = testSetROPumpMeasuredFeedbackDutyCycleOverride( payload.state.f32 ); + } + else + { + result = testResetROPumpMeasuredFeedbackDutyCycleOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGFillModeBroadcastOverrideRequest function handles a request + * to override the gen idle state publish interval + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGFillModeBroadcastOverrideRequest( 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 = testSetFillModeDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetFillModeDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} +/*********************************************************************//** + * @brief + * The handleTestDGFillIntegratedVolumeOverrideRequest function handles a request + * to override the gen idle state publish interval + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGFillIntegratedVolumeOverrideRequest( 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 = testSetIntegratedVolumeOverride( payload.state.u32 ); + } + else + { + result = testResetIntegratedVolumeOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/