Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rbf44edd28c59df78a75165764b6b654f2e91e556 -rf249310122b6543b4145bb4824966535c93515d0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision bf44edd28c59df78a75165764b6b654f2e91e556) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f249310122b6543b4145bb4824966535c93515d0) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Dara Navaei -* @date (last) 20-May-2023 +* @author (last) Sean Nash +* @date (last) 01-Jun-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -855,6 +855,10 @@ { result = signalUserInitiateChemcialDisinfectFlushMode(); } + else if ( DG_DISINFECT_RO_PERMEATE_SAMPLE_STATE == cmd ) // Command 4 = RO permeate sample + { + result = signalUserInitiateROPermeateSampleMode(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); @@ -1807,7 +1811,7 @@ /*********************************************************************//** * @brief - * The sendDGStartChemicalDisinfectFlushModeCommand function constructs a DG + * The sendDGStartStopChemicalDisinfectFlushModeCommand function constructs a DG * start/stop chemical disinfect flush mode command message and queues the msg * for transmit on the appropriate CAN channel. * @details Inputs: none @@ -1816,7 +1820,7 @@ * @param start TRUE indicates start chemical disinfect flush mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGStartChemicalDisinfectFlushModeCommand( BOOL start ) +BOOL sendDGStartStopChemicalDisinfectFlushModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; @@ -1863,6 +1867,7 @@ payload.alarmsFlags |= ( almStatus.alarmsToEscalate ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_TO_ESCALATE) : 0 ); payload.alarmsFlags |= ( almStatus.alarmsSilenced ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_ALARMS_SILENCED) : 0 ); payload.alarmsFlags |= ( almStatus.lampOn ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_LAMP_ON) : 0 ); + payload.alarmsFlags |= ( almStatus.noReTrigger ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_RETRIGGER) : 0 ); payload.alarmsFlags |= ( almStatus.noBloodRecirc ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_BLOOD_RECIRC) : 0 ); payload.alarmsFlags |= ( almStatus.noDialRecirc ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_DIALYSATE_RECIRC) : 0 ); payload.alarmsFlags |= ( almStatus.noMinimize ? BIT_BY_POS(ALARM_STATE_FLAG_BIT_POS_NO_MINIMIZE) : 0 ); @@ -3270,11 +3275,9 @@ { MESSAGE_T msg; HD_SERVICE_RECORD_T service; - DG_SERVICE_AND_USAGE_DATA_T dgData; U08 *payloadPtr = msg.payload; getNVRecord2Driver( GET_SRV_RECORD, (U08*)&service, sizeof( HD_SERVICE_RECORD_T ), 0, ALARM_ID_NO_ALARM ); - getHDVersionDGServiceAndUsageData( &dgData ); // Create a message record blankMessage( &msg ); @@ -3286,11 +3289,8 @@ // Fill message payload memcpy( payloadPtr, &service.lastServiceEpochDate, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); + service.serviceIntervalSeconds = ( 0 == service.lastServiceEpochDate ? 0 : service.serviceIntervalSeconds ); memcpy( payloadPtr, &service.serviceIntervalSeconds, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.lastServiceEpochDate, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &dgData.dgServiceRecord.serviceIntervalSeconds, sizeof( U32 ) ); } // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer @@ -3362,16 +3362,16 @@ * The sendConfirmationRequest function sends a confirmation request to UI * @details Inputs: none * @details Outputs: none - * @param request_id ID of confirmation being requested - * @param request_type Type of confirmation being requested - * @param reject_reason Reason Reason for reject if type is reject + * @param requestID ID of confirmation being requested + * @param requestType Type of confirmation being requested + * @param rejectReason Reason Reason for reject if type is reject * @return none *************************************************************************/ -void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; - U32 temp_request = request_id; + U32 temp_request = requestID; // Create a message record blankMessage( &msg ); @@ -3381,13 +3381,13 @@ memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - temp_request = request_type; + temp_request = requestType; memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &reject_reason, sizeof( U32 ) ); + memcpy( payloadPtr, &rejectReason, sizeof( U32 ) ); // 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_HD_2_UI, ACK_NOT_REQUIRED ); + serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); } /*********************************************************************//** @@ -3406,8 +3406,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; - // The payload length is U32 Request ID, U32 Type + msg.hdr.msgID = MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG; msg.hdr.payloadLen = sizeof( U32 ); memcpy( payloadPtr, &status, sizeof( U32 ) ); @@ -3416,7 +3415,107 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_NOT_REQUIRED ); } +/*********************************************************************//** + * @brief + * The sendDGStopActiveCoolModeCommand function sends a request to stop + * active cool mode command + * @details Inputs: none + * @details Outputs: none + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendDGStopActiveCoolModeCommand( void ) +{ + BOOL result; + MESSAGE_T msg; + BOOL start = FALSE; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( msg.payload, &start, sizeof( BOOL ) ); + + // 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; +} + +/*********************************************************************//** + * @brief + * The sendDGStartStopDGROPermeateSampleModeCommand function sends a request + * to start or stop RO permeate sample mode command + * @details Inputs: none + * @details Outputs: none + * @param start TRUE to star the RO permeate sample mode and FALSE to stop + * the RO permeate sample mode + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendDGStartStopDGROPermeateSampleModeCommand( BOOL start ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( msg.payload, &start, sizeof( BOOL ) ); + + // 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; +} + +/*********************************************************************//** + * @brief + * The sendRequestROPermeateSampleCollectionToDG function sends a request + * to collect RO permeate sample to DG + * @details Inputs: none + * @details Outputs: none + * @param status which could be dispense or cancel + * @return TRUE if the command was serialized successfully + *************************************************************************/ +BOOL sendRequestROPermeateSampleCollectionToDG( U32 status ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_RO_PERMEATE_SAMPLE_DISPENSE_REQUEST_TO_DG; + msg.hdr.payloadLen = sizeof( U32 ); + + memcpy( msg.payload, &status, 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_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleReceiveROPermeateSampleReadyToDispenseFromDG function receives + * the signal from DG that it is ready to dispnese more in RO permeate sample + * mode + * @details Inputs: none + * @details Outputs: none + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleReceiveROPermeateSampleReadyToDispenseFromDG( MESSAGE_T* message ) +{ + if ( 0 == message->hdr.payloadLen ) + { + signalROPermeateSampleDGReadyToDispense(); + } +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -7395,7 +7494,7 @@ // Create a message record blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_DG_SERVICE_RECORD_REQUEST; + msg.hdr.msgID = MSG_ID_HD_REQUEST_SERVICE_RECORD_FROM_HD; msg.hdr.payloadLen = 0; // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer @@ -8226,4 +8325,28 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** + * @brief + * The handleTestHDSetRecoverFromFaultModeSignal function handles a request to + * set the signal to recover from the fault mode. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDSetRecoverFromFaultModeSignal( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + status = TRUE; + + setRecoverFromFaultModeSignal(); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/