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();