Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rcb83129ca29f7f99583481420808a96f1848bb36 -r140ae221faea91628aabbc24c453f86078e94918 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision cb83129ca29f7f99583481420808a96f1848bb36) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 140ae221faea91628aabbc24c453f86078e94918) @@ -8,7 +8,7 @@ * @file DGInterface.c * * @author (last) Sean Nash -* @date (last) 10-Feb-2023 +* @date (last) 08-Mar-2023 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -80,7 +80,8 @@ static F32 lgLoadCellBackupReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< Rolling total - used to calc large load cell moving average. // DG Dialysate flow rate -static F32 dgDialysateFlowRateMlMin = 0.0; ///< Latest dialysate flow rate reported by the DG. +static F32 dgDialysateFlowRateLMin; ///< Latest dialysate flow rate (in L/min) reported by the DG. +static F32 dgDialysateFlowRateRawLMin; ///< Latest raw dialysate flow rate (in L/min) reported by the DG. static BOOL dgDialysateFlowDataFreshFlag = FALSE; ///< Flag to signal the execDialInFlowMonitor() to process fresh flow rate data static BOOL dgLoadCellDataFreshFlag = FALSE; ///< Flag to signal the handleLoadCellReadingsFromDG() to process fresh load cell data static BOOL dgDialysateTemperatureDataFreshFlag = FALSE; ///< Flag to signal the handleTemperatureReadingsFromDG() to process fresh temperature data @@ -132,7 +133,8 @@ dgCurrentOpMode = DG_MODE_INIT; dgSubMode = 0; dgStartCommandSent = FALSE; - dgDialysateFlowRateMlMin = 0.0F; + dgDialysateFlowRateLMin = 0.0F; + dgDialysateFlowRateRawLMin = 0.0F; dgDialysateFlowDataFreshFlag = FALSE; dgHeatDisinfectTemp = 0.0F; @@ -313,19 +315,34 @@ * @brief * The getDGDialysateFlowRateLMin function gets the latest dialysate flow * rate reported by the DG. - * @details Inputs: dgDialysateFlowRateMlMin + * @details Inputs: dgDialysateFlowRateLMin * @details Outputs: none * @return Latest dialysate flow rate (in L/min) reported by DG. *************************************************************************/ F32 getDGDialysateFlowRateLMin( void ) { - F32 result = dgDialysateFlowRateMlMin; + F32 result = dgDialysateFlowRateLMin; return result; } /*********************************************************************//** * @brief + * The getDGRawDialysateFlowRateLMin function gets the latest raw dialysate flow + * rate reported by the DG. + * @details Inputs: dgDialysateFlowRateRawLMin + * @details Outputs: none + * @return Latest dialysate flow rate (in L/min) reported by DG. + *************************************************************************/ +F32 getDGRawDialysateFlowRateLMin( void ) +{ + F32 result = dgDialysateFlowRateRawLMin; + + return result; +} + +/*********************************************************************//** + * @brief * The getDialysateFlowDataFreshFlag function returns a flag to indicate * if the dialysate flow rate data reported by the DG is fresh or stale data. * @details Inputs: dgDialysateFlowDataFreshFlag @@ -573,19 +590,25 @@ * The setDialysateFlowData function sets the latest dialysate flow rate * and its freshness status. The dialysate flow data is reported by the DG. * @details Inputs: none - * @details Outputs: dgDialysateFlowRateMlMin, dgDialysateFlowDataFreshFlag - * @param flowRate latest dialysate flow rate (mL/min) reported by DG + * @details Outputs: dgDialysateFlowRateLMin, dgDialysateFlowRateRawLMin, + * dgDialysateFlowDataFreshFlag + * @param flowRates latest DG flow rates (mL/min) reported by DG * @return none *************************************************************************/ -void setDialysateFlowData( F32 flowRate ) +void setDialysateFlowData( FLOW_SENSORS_DATA_T flowRates ) { // Check if the sent value by DG is a NaN - if ( isnan( flowRate ) ) + if ( isnan( flowRates.dialysateFlowRateLPM ) ) { - flowRate = 0.0; + flowRates.dialysateFlowRateLPM = 0.0F; } + if ( isnan( flowRates.dialysateRawFlowRateLPM ) ) + { + flowRates.dialysateRawFlowRateLPM = 0.0F; + } - dgDialysateFlowRateMlMin = flowRate; + dgDialysateFlowRateLMin = flowRates.dialysateFlowRateLPM; + dgDialysateFlowRateRawLMin = flowRates.dialysateRawFlowRateLPM; dgDialysateFlowDataFreshFlag = TRUE; } Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -rcb83129ca29f7f99583481420808a96f1848bb36 -r140ae221faea91628aabbc24c453f86078e94918 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision cb83129ca29f7f99583481420808a96f1848bb36) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 140ae221faea91628aabbc24c453f86078e94918) @@ -7,8 +7,8 @@ * * @file DGInterface.h * -* @author (last) Dara Navaei -* @date (last) 07-Mar-2023 +* @author (last) Sean Nash +* @date (last) 08-Mar-2023 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -111,7 +111,8 @@ DG_RESERVOIR_ID_T getDGInactiveReservoir( void ); BOOL hasDGCompletedReservoirSwitch( void ); BOOL getDialysateFlowDataFreshFlag( void ); -F32 getDGDialysateFlowRateLMin( void ); +F32 getDGDialysateFlowRateLMin( void ); +F32 getDGRawDialysateFlowRateLMin( void ); F32 getLoadCellWeight( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeight( DG_RESERVOIR_ID_T resID ); F32 getReservoirWeightLargeFilter( DG_RESERVOIR_ID_T resID ); @@ -125,7 +126,7 @@ void setDGOpMode( U32 opMode, U32 subMode ); void setDialysateTemperatureReadings( F32 tdi, F32 tro, F32 thd ); void setDGReservoirsData( DG_RESERVOIR_ID_T resID, U32 fillVol, U32 drainVol ); -void setDialysateFlowData( F32 flowRate ); +void setDialysateFlowData( FLOW_SENSORS_DATA_T flowRates ); void setNewLoadCellReadings( F32 res1Primary, F32 res1Backup, F32 res2Primary, F32 res2Backup ); void setDGDisinfectsStates( DG_DISINFECT_UI_STATES_T states ); void setDGMixingRatios( DG_MIXING_RATIOS_T ratios ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r47f6ff71b7ca3037c673e21f11b0b2a9dd1558bf -r140ae221faea91628aabbc24c453f86078e94918 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 47f6ff71b7ca3037c673e21f11b0b2a9dd1558bf) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 140ae221faea91628aabbc24c453f86078e94918) @@ -1723,6 +1723,19 @@ case MSG_ID_HD_BATTERY_COMM_STATUS_OVERRIDE: handleBatteryI2CStatusOverrideRequest( message ); break; + + case MSG_ID_HD_DIAL_IN_PUMP_HARD_STOP: + handleDialInPumpHardStopRequest( message ); + break; + + case MSG_ID_HD_DIAL_OUT_PUMP_HARD_STOP: + handleDialOutPumpHardStopRequest( message ); + break; + + case MSG_ID_HD_BLOOD_PUMP_HARD_STOP: + handleBloodPumpHardStopRequest( message ); + break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa -r140ae221faea91628aabbc24c453f86078e94918 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0a61f7fa5ff6945ebc2e507d8ecb71a652c38eaa) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 140ae221faea91628aabbc24c453f86078e94918) @@ -851,18 +851,22 @@ memcpy( &cmd, message->payload, sizeof(U32) ); - if ( 0 == cmd ) // Command 0 = Flush + if ( DG_DISINFECT_FLUSH_STATE == cmd ) // Command 0 = Flush { result = signalUserInitiateFlushMode(); } - else if ( 1 == cmd ) // Command 1 = Heat disinfect + else if ( DG_DISINFECT_HEAT_STATE == cmd ) // Command 1 = Heat disinfect { result = signalUserInitiateHeatDisinfectMode(); } - else if ( 2 == cmd ) // Command 2 = chemical disinfect + else if ( DG_DISINFECT_CHEM_STATE == cmd ) // Command 2 = chemical disinfect { result = signalUserInitiateChemicalDisinfectMode(); } + else if ( DG_DISINFECT_CHEM_FLUSH_STATE == cmd ) // Command 3 = chemical disinfect flush + { + result = signalUserInitiateChemcialDisinfectFlushMode(); + } } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); @@ -1050,7 +1054,7 @@ payloadPtr += sizeof( U32 ); memcpy( payloadPtr, &reason, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, alarmList, size ); + memcpy( payloadPtr, alarmList, sizeof( U32 ) ); // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer return serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); @@ -1798,6 +1802,35 @@ /*********************************************************************//** * @brief + * The sendDGStartChemicalDisinfectFlushModeCommand 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 + * @details Outputs: DG start chemical disinfect flush mode command msg + * constructed and queued. + * @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 result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_CHEM_DISINFECT_FLUSH; + 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 broadcastAlarmStatus function constructs an alarm status msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none @@ -3305,7 +3338,7 @@ if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) { - setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T) request_id, (CONFIRMATION_REQUEST_STATUS_T) status ); + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T)request_id, (CONFIRMATION_REQUEST_STATUS_T)status ); } } @@ -3345,7 +3378,33 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_NOT_REQUIRED ); } +/*********************************************************************//** + * @brief + * The handleSendChemFlushPassFailToDG function sends the result of the + * chemical disinfect flush sample pass/fail to DG + * @details Inputs: none + * @details Outputs: none + * @param status which is the status of the result + * @return none + *************************************************************************/ +void handleSendChemFlushPassFailToDG( U32 status ) +{ + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + // 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.payloadLen = sizeof( U32 ); + + memcpy( payloadPtr, &status, 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_DG, ACK_NOT_REQUIRED ); +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -7939,4 +7998,73 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleDialInPumpHardStopRequest function handles a + * request to stop the dial in pump. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDialInPumpHardStopRequest( MESSAGE_T * message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( 0 == message->hdr.payloadLen ) + { + signalDialInPumpHardStop(); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleDialOutPumpHardStopRequest function handles a + * request to stop the dial out pump. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDialOutPumpHardStopRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( 0 == message->hdr.payloadLen ) + { + signalDialOutPumpHardStop(); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleBloodPumpHardStopRequest function handles a + * request to stop the blood pump. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleBloodPumpHardStopRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify payload length + if ( 0 == message->hdr.payloadLen ) + { + signalBloodPumpHardStop(); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/