Index: firmware/App/Controllers/Ultrafiltration.c =================================================================== diff -u -r94789b2f2324d5901685b6ff7b6224d4af3a0276 -r60e6185c2c5df195ccb6b603f30548779b4f05c4 --- firmware/App/Controllers/Ultrafiltration.c (.../Ultrafiltration.c) (revision 94789b2f2324d5901685b6ff7b6224d4af3a0276) +++ firmware/App/Controllers/Ultrafiltration.c (.../Ultrafiltration.c) (revision 60e6185c2c5df195ccb6b603f30548779b4f05c4) @@ -37,6 +37,7 @@ #define COMP_SLOPE -0.000376F ///< UF Temperature compensation slope factor #define COMP_INTERCEPT 1.007269F ///< UF temperature compensation intercept factor #define ZERO_RATE 0.0F ///< Zero value. +#define UF_VOLUME_ML_PER_ML_MIN_PER_TASK ( (F32)TASK_GENERAL_INTERVAL / ( (F32)MS_PER_SECOND * (F32)SEC_PER_MIN ) ) // ********** private data ********** @@ -47,6 +48,7 @@ static U32 ufDataPublicationTimerCounter; ///< Used to schedule ultrafiltration data publication to CAN bus. static BOOL isUFRateUpdated; ///< flag indicating to update UF rate needed. static OVERRIDE_U32_T ufDataPublishInterval; ///< Ultrafiltration data publish interval. +static F32 ufVolumeDeliveredMl; ///< Accumulated UF volume delivered in mL. // ********** private function prototypes ********** @@ -75,6 +77,7 @@ compUFrate = getTDUFRate(); ufDataPublicationTimerCounter = 0; isUFRateUpdated = FALSE; + ufVolumeDeliveredMl = 0.0F; } /*********************************************************************//** @@ -122,6 +125,11 @@ // Calculate UF volume and determine UF pause/run updateUFRequest(); + if ( ( DD_UF_RUNNING == ufExecState ) && ( compUFrate > ZERO_RATE ) ) + { + ufVolumeDeliveredMl += compUFrate * UF_VOLUME_ML_PER_ML_MIN_PER_TASK; + } + // execute current ultrafiltration exec state switch ( ufExecState ) { @@ -230,6 +238,30 @@ /*********************************************************************//** * @brief + * The resetUFVolumeDelivered function resets the accumulated UF volume. + * @details \b Inputs: none + * @details \b Outputs: ufVolumeDeliveredMl + * @return none + *************************************************************************/ +void resetUFVolumeDelivered( void ) +{ + ufVolumeDeliveredMl = 0.0F; +} + +/*********************************************************************//** + * @brief + * The getUFVolumeDeliveredLiters function returns accumulated UF volume. + * @details \b Inputs: ufVolumeDeliveredMl + * @details \b Outputs: none + * @return UF volume delivered in liters. + *************************************************************************/ +F32 getUFVolumeDeliveredLiters( void ) +{ + return ufVolumeDeliveredMl / (F32)ML_PER_LITER; +} + +/*********************************************************************//** + * @brief * The UpdateUFCompensation function updates the ultrafiltration rate * based on the dialysate temperature compensation. * @details \b Inputs: D4 and D50 temperature @@ -304,6 +336,7 @@ data.ufRate = getTDUFRate(); data.compUFrate = compUFrate; data.isUFRequested = (U32)isUltrafiltrationRequested; + data.ufVolumeDeliveredMl = ufVolumeDeliveredMl; broadcastData( MSG_ID_DD_UF_DATA, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&data, sizeof( UF_DATA_T ) ); Index: firmware/App/Controllers/Ultrafiltration.h =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -r60e6185c2c5df195ccb6b603f30548779b4f05c4 --- firmware/App/Controllers/Ultrafiltration.h (.../Ultrafiltration.h) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Controllers/Ultrafiltration.h (.../Ultrafiltration.h) (revision 60e6185c2c5df195ccb6b603f30548779b4f05c4) @@ -38,6 +38,7 @@ F32 ufRate; ///< Ultrafiltration rate from TD F32 compUFrate; ///< Compensated UF rate U32 isUFRequested; ///< Ultrafiltration run or puase request + F32 ufVolumeDeliveredMl; ///< UF volume delivered in mL } UF_DATA_T; // ********** public function prototypes ********** @@ -47,6 +48,8 @@ U32 execUFControl( void ); // Execute the ultrafiltration state machine UF_EXEC_STATE_T getCurrentUFExecState( void ); // Get the current state of the balancing chamber execution void signalUFRateUpdate( void ); // Update UF rate when there is a change in rate +void resetUFVolumeDelivered( void ); // Reset accumulated UF volume delivered +F32 getUFVolumeDeliveredLiters( void ); // Get accumulated UF volume delivered in L BOOL testDDUFDataPublishIntervalOverride( MESSAGE_T *message ); // To override the UF data publish interval Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -ra6737c3bcc8286c153b778c2c395f465e76aaafb -r60e6185c2c5df195ccb6b603f30548779b4f05c4 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision a6737c3bcc8286c153b778c2c395f465e76aaafb) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 60e6185c2c5df195ccb6b603f30548779b4f05c4) @@ -94,18 +94,21 @@ static BOOL delayBypassStateFlag; ///< To indicate change in treatment parameters static F32 dialysateToDialyzerFlowRate; ///< Current dialysate to dialyzer flow rate (ml/min) static U32 d48PumpSpeed; ///< Initial D48 pump speed based on the Qd. +static DD_GEND_ISO_UF_SUB_STATE_T isolatedUFSubState; ///< Isolated UF run/pause sub-state. // ********** private function prototypes ********** static void setModeGenDStateTransition( DD_GEND_MODE_STATE_T state ); static DD_GEND_MODE_STATE_T handleGenDDialysateBypassState( void ); static DD_GEND_MODE_STATE_T handleGenDDialysateDeliveryState( void ); static DD_GEND_MODE_STATE_T handleGenDDialysateDeliveryPauseState( void ); -static DD_GEND_MODE_STATE_T handleGenDSpentChamberFillState(void); +static DD_GEND_MODE_STATE_T handleGenDSpentChamberFillState( void ); static DD_GEND_MODE_STATE_T handleGenDBicarbChamberFillState( void ); -static DD_GEND_MODE_STATE_T handleGenDIsolatedUFState( void ); +static DD_GEND_MODE_STATE_T handleGenDDialysateIsolatedUFState( void ); static F32 getGenDialysateTargetTemperature( void ); static void updateDialysateToDialyzerFlowRate( void ); +static DD_GEND_MODE_STATE_T applyTDRequestedGenDialysateState( DD_GEND_MODE_STATE_T state ); +static DD_GEND_ISO_UF_SUB_STATE_T getIsolatedUFSubStateForUFRate( void ); static void checkDialysateTemperature( void ); static void monitorChamberLevelStatus( void ); static void publishGenDialysateModeData( void ); @@ -148,6 +151,7 @@ bypassStateDelayStartTimeMS = 0; delayBypassStateFlag = TRUE; dialysateToDialyzerFlowRate = 0.0F; + isolatedUFSubState = DD_GEND_ISO_UF_PAUSE_STATE; //Initialize balancing chamber module initBalanceChamber(); @@ -478,9 +482,61 @@ break; case DD_GEND_ISOLATED_UF_STATE: - // Deactivate Balancing Chamber Switching - requestBalChamberSwitching( FALSE ); - //TODO : define actuators states + isolatedUFSubState = getIsolatedUFSubStateForUFRate(); + resetUFVolumeDelivered(); + + transitionToBalChamberFill(); + // Activate Balancing Chamber Switching + requestBalChamberSwitching( TRUE ); + + setValveState( D8_VALV, VALVE_STATE_CLOSED ); + setValveState( D14_VALV, VALVE_STATE_OPEN ); + setValveState( D31_VALV, VALVE_STATE_CLOSED ); + setValveState( D34_VALV, VALVE_STATE_CLOSED ); + setValveState( D91_VALV, VALVE_STATE_OPEN ); + setValveState( D35_VALV, VALVE_STATE_CLOSED ); + setValveState( D40_VALV, VALVE_STATE_OPEN ); + setValveState( D47_VALV, VALVE_STATE_CLOSED ); + setValveState( D52_VALV, VALVE_STATE_CLOSED ); + setValveState( D54_VALV, VALVE_STATE_CLOSED ); + setValveState( D100_VALV, VALVE_STATE_CLOSED ); + setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve (same as bypass/delivery during gen dialysate) + setValveState( D81_VALV, VALVE_STATE_CLOSED ); + setValveState( D85_VALV, VALVE_STATE_CLOSED ); + + if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == FALSE ) + { + setValveState( D80_VALV, VALVE_STATE_OPEN ); + setValveState( D64_VALV, VALVE_STATE_CLOSED ); + } + + calculateTargetDialysateTemp(); + setHeaterTargetTemperature( D5_HEAT, getGenDialysateTargetTemperature() ); + setD28TempFeedbackControl( TRUE ); + startHeater( D5_HEAT ); + + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D4_TEMP ) ); + } + else + { + setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D99_TEMP ) ); + } + startHeater( D45_HEAT ); + + setDialysatePumpTargetRPM( D12_PUMP, getFreshDialPumpInitialRpm(), TRUE ); + + if ( getTDDialysateFlowrate() > ZERO_DIAL_FLOW_RATE ) + { + setDialysatePumpTargetRPM( D48_PUMP, d48PumpSpeed, TRUE ); + } + else + { + signalDialysatePumpHardStop( D48_PUMP ); + } + + setRinsePumpState( RINSE_PUMP_STATE_ON ); break; default: @@ -556,7 +612,7 @@ break; case DD_GEND_ISOLATED_UF_STATE: - genDialysateState = handleGenDIsolatedUFState(); + genDialysateState = handleGenDDialysateIsolatedUFState(); break; default: @@ -718,18 +774,118 @@ /*********************************************************************//** * @brief + * The applyTDRequestedGenDialysateState function transitions the gen dialysate + * sub-state to match the latest TD request when allowed. + * @details \b Inputs: getTDRequestedGenDState, getDialGoodToDeliverStatus + * @details \b Outputs: isDialDeliveryInProgress + * @param state Current gen dialysate sub-state. + * @return Updated gen dialysate sub-state (unchanged if TD request not applied). + *************************************************************************/ +static DD_GEND_MODE_STATE_T applyTDRequestedGenDialysateState( DD_GEND_MODE_STATE_T state ) +{ + DD_GEND_MODE_STATE_T requested = (DD_GEND_MODE_STATE_T)getTDRequestedGenDState(); + + if ( state != requested ) + { + switch ( requested ) + { + case DD_GEND_DIALYSATE_BYPASS_STATE: + setModeGenDStateTransition( DD_GEND_DIALYSATE_BYPASS_STATE ); + isDialDeliveryInProgress.data = FALSE; + state = DD_GEND_DIALYSATE_BYPASS_STATE; + break; + + case DD_GEND_DIALYSATE_DELIVERY_STATE: + if ( TRUE == getDialGoodToDeliverStatus() ) + { + setModeGenDStateTransition( DD_GEND_DIALYSATE_DELIVERY_STATE ); + isDialDeliveryInProgress.data = TRUE; + state = DD_GEND_DIALYSATE_DELIVERY_STATE; + } + break; + + case DD_GEND_ISOLATED_UF_STATE: + setModeGenDStateTransition( DD_GEND_ISOLATED_UF_STATE ); + isDialDeliveryInProgress.data = FALSE; + state = DD_GEND_ISOLATED_UF_STATE; + break; + + default: + break; + } + } + + return state; +} + +/*********************************************************************//** + * @brief + * The getIsolatedUFSubStateForUFRate function maps the latest TD UF rate to + * the required isolated UF run/pause sub-state. + * @details \b Inputs: getTDUFRate + * @details \b Outputs: none + * @return isolated UF run sub-state when Quf > 0, pause otherwise. + *************************************************************************/ +static DD_GEND_ISO_UF_SUB_STATE_T getIsolatedUFSubStateForUFRate( void ) +{ + DD_GEND_ISO_UF_SUB_STATE_T subState = DD_GEND_ISO_UF_PAUSE_STATE; + + if ( getTDUFRate() > ZERO_DIAL_FLOW_RATE ) + { + subState = DD_GEND_ISO_UF_RUN_STATE; + } + + return subState; +} + +/*********************************************************************//** + * @brief * The handleGenDDialysateIsolatedUFState function performs the - * Isolated ultrafiltration operations. - * @details \b Inputs: none. + * isolated ultrafiltration operations. + * @details \b Inputs: none * @details \b Outputs: none * @return the current state of gen dialysate mode *************************************************************************/ -static DD_GEND_MODE_STATE_T handleGenDIsolatedUFState( void ) +static DD_GEND_MODE_STATE_T handleGenDDialysateIsolatedUFState( void ) { - DD_GEND_MODE_STATE_T state = DD_GEND_ISOLATED_UF_STATE; + DD_GEND_MODE_STATE_T state = DD_GEND_ISOLATED_UF_STATE; + BOOL balancingChambFillInProgress = getBalancingChamberFillinProgressStatus(); - //TODO: define isoalted ultrafiltration. + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_SPENT_CHAMBER_H_FILL ) ) + { + if ( ( TRUE == pendingSpentChamberFill ) && ( FALSE == balancingChambFillInProgress ) ) + { + setModeGenDStateTransition( DD_GEND_SPENT_CHAMBER_FILL_STATE ); + pendingSpentChamberFill = FALSE; + isDialDeliveryInProgress.data = FALSE; + state = DD_GEND_SPENT_CHAMBER_FILL_STATE; + } + } +#ifdef __BICARB_CHAMBER_FILL__ + if ( ( TRUE == pendingBicarbChamberFill ) && ( FALSE == balancingChambFillInProgress ) ) + { + setModeGenDStateTransition( DD_GEND_BICARB_CHAMBER_FILL_STATE ); + pendingBicarbChamberFill = FALSE; + isDialDeliveryInProgress.data = FALSE; + state = DD_GEND_BICARB_CHAMBER_FILL_STATE; + } +#endif + // If TD requests bypass, delivery, or another allowed sub-state, transition out of iso UF + state = applyTDRequestedGenDialysateState( state ); + + if ( DD_GEND_ISOLATED_UF_STATE == state ) + { + DD_GEND_ISO_UF_SUB_STATE_T desiredSubState = getIsolatedUFSubStateForUFRate(); + + if ( desiredSubState != isolatedUFSubState ) + { + isolatedUFSubState = desiredSubState; + } + + execUFControl(); + } + return state; } @@ -780,12 +936,7 @@ #endif //if the produced dialysate is good and TD asks for dialysate delivery //move to next state - if ( ( TRUE == getDialGoodToDeliverStatus() ) && ( FALSE == getTDDialyzerBypass() ) ) - { - setModeGenDStateTransition( DD_GEND_DIALYSATE_DELIVERY_STATE ); - isDialDeliveryInProgress.data = TRUE; - state = DD_GEND_DIALYSATE_DELIVERY_STATE; - } + state = applyTDRequestedGenDialysateState( state ); return state; } @@ -805,14 +956,18 @@ LEVEL_STATE_T bicarbChamberLevel = getLevelStatus( D63_LEVL ); BOOL balancingChambFillInProgress = getBalancingChamberFillinProgressStatus(); - // if TD asks for bypass or dialysate is not good to deliver - //transition to bypass dialystate state - if ( ( FALSE == getDialGoodToDeliverStatus() ) || ( TRUE == getTDDialyzerBypass() ) ) + // if TD asks for a different sub-state or dialysate is not good to deliver, + // transition out of delivery + if ( FALSE == getDialGoodToDeliverStatus() ) { setModeGenDStateTransition( DD_GEND_DIALYSATE_BYPASS_STATE ); isDialDeliveryInProgress.data = FALSE; state = DD_GEND_DIALYSATE_BYPASS_STATE; } + else if ( DD_GEND_DIALYSATE_DELIVERY_STATE != getTDRequestedGenDState() ) + { + state = applyTDRequestedGenDialysateState( state ); + } else if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_SPENT_CHAMBER_H_FILL ) == TRUE ) { if ( ( TRUE == pendingSpentChamberFill ) && ( FALSE == balancingChambFillInProgress ) ) @@ -975,6 +1130,19 @@ /*********************************************************************//** * @brief + * The getCurrentIsolatedUFSubState function returns the current isolated UF + * run/pause sub-state. + * @details \b Inputs: isolatedUFSubState + * @details \b Outputs: none + * @return current isolated UF sub-state. + *************************************************************************/ +DD_GEND_ISO_UF_SUB_STATE_T getCurrentIsolatedUFSubState( void ) +{ + return isolatedUFSubState; +} + +/*********************************************************************//** + * @brief * The setTreatmentParamUpdate function sets the flag to indicate one or more * treatement parameters updated. * gen dialysate mode. @@ -1036,6 +1204,18 @@ setD48PumpSpeedForBCFill( initialPumpSpeed ); setDialysatePumpTargetRPM( D48_PUMP, (U32)initialPumpSpeed, TRUE ); + if ( DD_GEND_ISOLATED_UF_STATE == genDialysateState ) + { + if ( getTDDialysateFlowrate() > ZERO_DIAL_FLOW_RATE ) + { + setDialysatePumpTargetRPM( D48_PUMP, d48PumpSpeed, TRUE ); + } + else + { + signalDialysatePumpHardStop( D48_PUMP ); + } + } + //reset the flag isTreatmentParamUpdated = FALSE; } @@ -1345,11 +1525,10 @@ case DD_GEND_STATE_START: case DD_GEND_DIALYSATE_BYPASS_STATE: case DD_GEND_DIALYSATE_DELIVERY_STATE: + case DD_GEND_ISOLATED_UF_STATE: case DD_GEND_SPENT_CHAMBER_FILL_STATE: result = TRUE; break; - - case DD_GEND_ISOLATED_UF_STATE: case DD_GEND_BICARB_CHAMBER_FILL_STATE: case DD_GEND_DIALYSATE_DELIVERY_PAUSE: default: @@ -1388,13 +1567,16 @@ isDialDeliveryInProgress.data = TRUE; break; + case DD_GEND_ISOLATED_UF_STATE: + isDialDeliveryInProgress.data = FALSE; + break; + case DD_GEND_SPENT_CHAMBER_FILL_STATE: pendingSpentChamberFill = FALSE; isDialDeliveryInProgress.data = FALSE; break; case DD_GEND_STATE_START: - case DD_GEND_ISOLATED_UF_STATE: case DD_GEND_BICARB_CHAMBER_FILL_STATE: case DD_GEND_DIALYSATE_DELIVERY_PAUSE: default: Index: firmware/App/Modes/ModeGenDialysate.h =================================================================== diff -u -ra6737c3bcc8286c153b778c2c395f465e76aaafb -r60e6185c2c5df195ccb6b603f30548779b4f05c4 --- firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision a6737c3bcc8286c153b778c2c395f465e76aaafb) +++ firmware/App/Modes/ModeGenDialysate.h (.../ModeGenDialysate.h) (revision 60e6185c2c5df195ccb6b603f30548779b4f05c4) @@ -47,6 +47,7 @@ BOOL hydChamberWaterInletControl( void ); // Hydraulics chamber inlet water control DD_GEND_MODE_STATE_T getCurrentGenDialysateState( void ); // Get the current state of the gen dialysate mode. +DD_GEND_ISO_UF_SUB_STATE_T getCurrentIsolatedUFSubState( void ); // Get isolated UF sub-state U32 getDialGoodToDeliverStatus( void ); // Get the dialysate good to deliver status void setTreatmentParamUpdate( void ); // To indicate one or more treatment parameters updated void updateTreatmentSettings( void ); // Process the recent treatment parameters changes Index: firmware/App/Services/TDInterface.c =================================================================== diff -u -r8f861eb50b8c751db8c9c76a9ae63bb4ab3d1cdc -r60e6185c2c5df195ccb6b603f30548779b4f05c4 --- firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision 8f861eb50b8c751db8c9c76a9ae63bb4ab3d1cdc) +++ firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision 60e6185c2c5df195ccb6b603f30548779b4f05c4) @@ -90,7 +90,7 @@ // TD status static TD_OP_MODE_T tdCurrentOpMode; ///< Current TD operation mode. static U32 tdSubMode; ///< Current state (sub-mode) of current TD operation mode. -static BOOL tdDialyzerBypass; ///< TD dialyzer bypass +static U32 tdRequestedGenDState; ///< TD-requested gen dialysate sub-state (DD_GEND_MODE_STATE_T). static BOOL tdOpModeDataFreshFlag = FALSE; ///< Flag to signal/process fresh TD op mode data static OVERRIDE_F32_T tdDialysateFlowrate; ///< TD Dialysate flow rate @@ -104,6 +104,7 @@ // ********** private function prototypes ********** static void checkTDDataFreshness( ALARM_ID_T alarmID, BOOL *tdFreshDataFlag ); +static BOOL isValidTDGenDStateRequest( U32 genDialysateState ); /*********************************************************************//** * @brief @@ -117,7 +118,7 @@ // Initialize unit state variables tdCurrentOpMode = MODE_INIT; tdSubMode = 0U; - tdDialyzerBypass = FALSE; + tdRequestedGenDState = DD_GEND_DIALYSATE_BYPASS_STATE; tdOpModeDataFreshFlag = FALSE; // Initialize treatment parameters from TD @@ -192,6 +193,29 @@ /*********************************************************************//** * @brief + * The isValidTDGenDStateRequest function validates a TD gen dialysate + * sub-state request. + * @details \b Inputs: genDialysateState + * @details \b Outputs: none + * @param genDialysateState Requested DD gen dialysate sub-state. + * @return TRUE if the request is a supported treatment sub-state. + *************************************************************************/ +static BOOL isValidTDGenDStateRequest( U32 genDialysateState ) +{ + BOOL result = FALSE; + + if ( ( DD_GEND_DIALYSATE_BYPASS_STATE == genDialysateState ) || + ( DD_GEND_DIALYSATE_DELIVERY_STATE == genDialysateState ) || + ( DD_GEND_ISOLATED_UF_STATE == genDialysateState ) ) + { + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The execTDInterfaceMonitor function executes the TD Interface monitoring * function. Ensures TD is sending fresh data in a timely manner. * @details \b Inputs: none @@ -297,16 +321,16 @@ /*********************************************************************//** * @brief - * The setTDDialyzerBypass function sets the latest TD dialyzer bypass - * enable. + * The setTDRequestedGenDState function sets the latest TD-requested gen + * dialysate sub-state. * @details \b Inputs: none - * @details \b Outputs: tdDialyzerBypass - * @param Dialyzer Bypass enable. + * @details \b Outputs: tdRequestedGenDState + * @param genDialysateState Requested DD gen dialysate sub-state. * @return none. *************************************************************************/ -void setTDDialyzerBypass( BOOL dialBypass ) +void setTDRequestedGenDState( U32 genDialysateState ) { - tdDialyzerBypass = dialBypass; + tdRequestedGenDState = genDialysateState; } /*********************************************************************//** @@ -368,15 +392,15 @@ /*********************************************************************//** * @brief - * The getTDDialyzerBypass function gets the latest TD dailyzer bypass valve - * enable flag. - * @details \b Inputs: tdDialyzerBypass + * The getTDRequestedGenDState function gets the latest TD-requested gen + * dialysate sub-state. + * @details \b Inputs: tdRequestedGenDState * @details \b Outputs: none - * @return Latest dialyzer bypass valve enable. + * @return Latest requested gen dialysate sub-state. *************************************************************************/ -BOOL getTDDialyzerBypass( void ) +U32 getTDRequestedGenDState( void ) { - return tdDialyzerBypass; + return tdRequestedGenDState; } /****************************************************************************** @@ -538,10 +562,13 @@ setTDUFRate( startTxRequest.ufRate ); setTDTargetDialysateTemperature( startTxRequest.dialTemp ); - // Set concentrate types, Bypass dialyzer + // Set concentrate types and requested gen dialysate sub-state setTDAcidAndBicarbType( startTxRequest.acidConvFactor, startTxRequest.bicarbConvFactor, startTxRequest.sodium, startTxRequest.bicarbonate ); - setTDDialyzerBypass( startTxRequest.bypassDialyzer ); + if ( TRUE == isValidTDGenDStateRequest( startTxRequest.genDialysateState ) ) + { + setTDRequestedGenDState( startTxRequest.genDialysateState ); + } // start dialysate generation result = requestDDGenDialStart(); @@ -567,10 +594,13 @@ setTDUFRate( startTxRequest.ufRate ); setTDTargetDialysateTemperature( startTxRequest.dialTemp ); - // Set concentrate types, Bypass dialyzer + // Set concentrate types and requested gen dialysate sub-state setTDAcidAndBicarbType( startTxRequest.acidConvFactor, startTxRequest.bicarbConvFactor, startTxRequest.sodium, startTxRequest.bicarbonate ); - setTDDialyzerBypass( startTxRequest.bypassDialyzer ); + if ( TRUE == isValidTDGenDStateRequest( startTxRequest.genDialysateState ) ) + { + setTDRequestedGenDState( startTxRequest.genDialysateState ); + } // Signal to update treatement parameters setTreatmentParamUpdate(); Index: firmware/App/Services/TDInterface.h =================================================================== diff -u -rabe1c4a42afb385a660381e48bd007331f60950c -r60e6185c2c5df195ccb6b603f30548779b4f05c4 --- firmware/App/Services/TDInterface.h (.../TDInterface.h) (revision abe1c4a42afb385a660381e48bd007331f60950c) +++ firmware/App/Services/TDInterface.h (.../TDInterface.h) (revision 60e6185c2c5df195ccb6b603f30548779b4f05c4) @@ -45,13 +45,13 @@ void setTDDialysateFlowrate( F32 dialFlowrate ); void setTDUFRate( F32 ufRate ); void setTDTargetDialysateTemperature( F32 dialTemperature ); -void setTDDialyzerBypass( BOOL dialBypass ); +void setTDRequestedGenDState( U32 genDialysateState ); void setTDAcidAndBicarbType( F32 acidConvFactor, F32 bicarbConvFactor, U32 sodium, U32 bicarbonate ); U32 getTDSubMode( void ); F32 getTDDialysateFlowrate( void ); F32 getTDUFRate( void ); F32 getTDTargetDialysateTemperature( void ); -BOOL getTDDialyzerBypass( void ); +U32 getTDRequestedGenDState( void ); F32 getTDAcidConversionFactor( void ); F32 etTDBicarbConversionFactor( void ); U32 getTDSodiumConcentration( void );