Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -rbdb9a1b636579c7bcfe95b329aa7e41ce161db13 -r30cbd9ff622e635f16df3801aabeb15dfaf5fff5 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision bdb9a1b636579c7bcfe95b329aa7e41ce161db13) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 30cbd9ff622e635f16df3801aabeb15dfaf5fff5) @@ -76,7 +76,6 @@ #define DELAY_FMP_CHECK_START_BY_MS ( 10 * MS_PER_SECOND ) ///< Delay start of FMP check during dialysate deliver state by this amount of time (in ms). #define CONCENTRATE_TEST_COND_COLLECTION_DELAY_MS ( 5 * MS_PER_SECOND ) ///< Concentrate test conductivity data collection delay in milliseconds. -#define MAX_RO_REJECTION_RATIO_ALLOW 0.10F ///< Maximum RO rejection ratio. #define MAX_CPO_CONDUCTIVITY_ALLOW 100.0F ///< Maximum CPo sensor conductivity value. #define MIN_FILL_TARGET_TO_CHECK_RO_AND_CPO_ML 550 ///< Minimum fill target to check the RO and CPo alarms in milliliters. @@ -171,6 +170,8 @@ // NOTE: This variable should be initialized here because the init function is called every time and then it cannot be initialized there. This variable is // set via Dialin for calibration check purposes only static DIALIN_FILL_FOR_CAL_CHECK_T dialinFillForCalCheck = DIALIN_FILL_FOR_CAL_NONE; ///< Dialin fill for calibration check. +// NOTE: this variable should be initialized here because the init function is called every time and then this variable is set to 0.0. +static F32 roRejectionRatioFromHD = 0.0F; ///< RO rejection ratio from HD. static OVERRIDE_F32_T usedAcidVolumeML = { 0.0, 0.0, 0.0, 0.0 }; ///< The integrated acid concentration volume has been used in mL. static OVERRIDE_F32_T usedBicarbVolumeML = { 0.0, 0.0, 0.0, 0.0 }; ///< The integrated bicarb concentration volume has been used in mL. static OVERRIDE_U32_T fillModeDataPublishInterval = { FILL_MODE_DATA_PUB_INTERVAL, @@ -608,6 +609,20 @@ /*********************************************************************//** * @brief + * The setRORejectionRatio function sets the RO rejection ratio that has + * been received from the HD institutional record. + * @details Inputs: none + * @details Outputs: roRejectionRatioFromHD + * @param RO rejection ratio + * @return none + *************************************************************************/ +void setRORejectionRatio( F32 roRejectionRatio ) +{ + roRejectionRatioFromHD = roRejectionRatio; +} + +/*********************************************************************//** + * @brief * The handleTestInletWaterState function tests for inlet water quality * and if this is the first fill of a treatment, prime the acid and bicarb * lines before jumping to dialysate production state. @@ -625,6 +640,7 @@ // to dialysate production directly if ( TRUE == isThisTheFirstFill() ) { + sendRORejectionRatioRequestToHD(); result = DG_FILL_MODE_STATE_PRIME_CONCENTRATE_LINES; if ( TRUE == getTestConfigStatus( TEST_CONFIG_EXPEDITE_PRE_TREATMENT ) ) @@ -968,10 +984,10 @@ // Fault alarm per PRS 483 SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE, avgCPo, MAX_CPO_CONDUCTIVITY_ALLOW ); } - if ( ( avgRR > MAX_RO_REJECTION_RATIO_ALLOW ) && ( isROOnlyModeEnabled() != TRUE ) ) + if ( ( avgRR > roRejectionRatioFromHD ) && ( isROOnlyModeEnabled() != TRUE ) ) { // Fault alarm per PRS 483 - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_RO_REJECTION_RATIO_OUT_OF_RANGE, avgRR, MAX_RO_REJECTION_RATIO_ALLOW ); + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_RO_REJECTION_RATIO_OUT_OF_RANGE, avgRR, roRejectionRatioFromHD ); } } Index: firmware/App/Modes/ModeFill.h =================================================================== diff -u -r721bd715bef050760e5c0f79044d1cba642c8354 -r30cbd9ff622e635f16df3801aabeb15dfaf5fff5 --- firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision 721bd715bef050760e5c0f79044d1cba642c8354) +++ firmware/App/Modes/ModeFill.h (.../ModeFill.h) (revision 30cbd9ff622e635f16df3801aabeb15dfaf5fff5) @@ -79,6 +79,8 @@ void setAcidAndBicarbType( U32 acid, U32 bicarb ); +void setRORejectionRatio( F32 roRejectionRatio ); + BOOL testSetUsedAcidVolumeMLOverride( F32 value ); BOOL testResetUsedAcidVolumeMLOverride( void ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r721bd715bef050760e5c0f79044d1cba642c8354 -r30cbd9ff622e635f16df3801aabeb15dfaf5fff5 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 721bd715bef050760e5c0f79044d1cba642c8354) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 30cbd9ff622e635f16df3801aabeb15dfaf5fff5) @@ -977,6 +977,10 @@ handleSendDGServiceRecordToHD( message ); break; + case MSG_ID_HD_RO_REJ_RATIO_FROM_HD_INSTIT_RECORD_TO_DG_RESPONSE: + handleRORejectionResponseFromHDInstitRecord( message ); + break; + // NOTE: This case must be last case MSG_ID_DG_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r8a89e041755b26fad2530e1b8ad2cfeed1937b0a -r30cbd9ff622e635f16df3801aabeb15dfaf5fff5 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8a89e041755b26fad2530e1b8ad2cfeed1937b0a) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 30cbd9ff622e635f16df3801aabeb15dfaf5fff5) @@ -1987,7 +1987,53 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); } +/*********************************************************************//** + * @brief + * The sendRORejectionRatioRequestToHD function handles sending the RO + * rejection ratio request to HD + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void sendRORejectionRatioRequestToHD( void ) +{ + MESSAGE_T msg; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_RO_REJ_RATIO_FROM_HD_INSTIT_RECORD_REQUEST; + msg.hdr.payloadLen = 0; + + // 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 handleRORejectionResponseFromHDInstitRecord function handles receiving + * RO rejection ratio response from HD institutional record + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleRORejectionResponseFromHDInstitRecord( MESSAGE_T* message ) +{ + BOOL status = FALSE; + + if ( message->hdr.payloadLen == sizeof(F32) ) + { + F32 roRejectionRatio; + + memcpy( &roRejectionRatio, message->payload, sizeof(F32) ); + + + status = TRUE; + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, status ); +} + // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r721bd715bef050760e5c0f79044d1cba642c8354 -r30cbd9ff622e635f16df3801aabeb15dfaf5fff5 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 721bd715bef050760e5c0f79044d1cba642c8354) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 30cbd9ff622e635f16df3801aabeb15dfaf5fff5) @@ -201,6 +201,12 @@ // MSG_ID_DG_START_STOP_NOCTURNAL_HEAT_DISINFECT void handleStartStopDGPassiveCoolHeatDisifnect( MESSAGE_T* message ); +// MSG_ID_DG_RO_REJ_RATIO_FROM_HD_INSTIT_RECORD_REQUEST +void sendRORejectionRatioRequestToHD( void ); + +// MSG_ID_HD_RO_REJ_RATIO_FROM_HD_INSTIT_RECORD_TO_DG_RESPONSE +void handleRORejectionResponseFromHDInstitRecord( MESSAGE_T* message ); + // *********** public test support message functions ********** // MSG_TESTER_LOG_IN