Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r0b025cea0b0f290ea44714a8fae6d71ea05088b9 -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 0b025cea0b0f290ea44714a8fae6d71ea05088b9) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -29,6 +29,7 @@ #include "StateTxPaused.h" #include "Switches.h" #include "TaskGeneral.h" +#include "TubeSetInstall.h" #include "TxParams.h" #include "Valves.h" #include "Valve3Way.h" @@ -351,13 +352,10 @@ static BOOL isFluidBolusPermitted( void ) { BOOL result = FALSE; - BOOL isDialysateGoodToDeliver = TRUE; // TODO: replace TRUE with getDialysateGoodToDeliverStatus() when we are ready - //TODO: Uncomment and remove the modality when tube set type logic is implemented - //if ( ( TUBE_SET_TYPE_HDF == getTubeSetType() ) - if ( TREATMENT_MODALITY_HDF == getTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_MODALITY ) ) + if ( TUBE_SET_TYPE_HDF == getTubeSetType() ) { - result = ( TRUE == isDialysateGoodToDeliver ) ? TRUE : FALSE; + result = ( TRUE == getDialysateGoodToDeliverStatus() ) ? TRUE : FALSE; } else { Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r9c833ef5623ce842267e284d958820ac0dc3a7fc -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 9c833ef5623ce842267e284d958820ac0dc3a7fc) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -196,6 +196,7 @@ SW_FAULT_ID_MODE_POST_TREATMENT_INVALID_STATE1 = 165, SW_FAULT_ID_MODE_POST_TX_AUTO_EJECT_INVALID_STATE = 166, SW_FAULT_ID_INVALID_FLUID_BOLUS_STATE = 167, + SW_FAULT_ID_INVALID_TUBE_SET_TYPE = 168, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/StateServices/FluidBolus.c =================================================================== diff -u -r0b025cea0b0f290ea44714a8fae6d71ea05088b9 -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Services/StateServices/FluidBolus.c (.../FluidBolus.c) (revision 0b025cea0b0f290ea44714a8fae6d71ea05088b9) +++ firmware/App/Services/StateServices/FluidBolus.c (.../FluidBolus.c) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -27,6 +27,7 @@ #include "StateTxPaused.h" #include "TaskGeneral.h" #include "Timers.h" +#include "TubeSetInstall.h" #include "TxParams.h" #include "Valves.h" @@ -155,21 +156,17 @@ /*********************************************************************//** * @brief * The getFluidBolusMedium function determines the fluid bolus medium based - * on the current treatment modality and online fluid configuration. - * Substitution fluid applies to HDF treatment, or HD treatment with online - * fluid enabled. Saline applies to standard HD without online fluid. + * on the installed tube set type. * @details \b Inputs: none * @details \b Outputs: none - * @return FLUID_BOLUS_MEDIUM_SUBSTITUTE for HDF or HD-online, FLUID_BOLUS_MEDIUM_SALINE otherwise. + * @return FLUID_BOLUS_MEDIUM_SUBSTITUTE for HDF tubing set, + * FLUID_BOLUS_MEDIUM_SALINE otherwise. *************************************************************************/ FLUID_BOLUS_MEDIUM_T getFluidBolusMedium( void ) { FLUID_BOLUS_MEDIUM_T medium = FLUID_BOLUS_MEDIUM_SALINE; - U32 modality = getTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_MODALITY ); - //TODO: Uncomment and remove the modality when tube set type logic is implemented - //if ( ( TUBE_SET_TYPE_HDF == getTubeSetType() ) - if ( ( modality == TREATMENT_MODALITY_HDF ) ) + if ( TUBE_SET_TYPE_HDF == getTubeSetType() ) { medium = FLUID_BOLUS_MEDIUM_SUBSTITUTE; } @@ -368,7 +365,6 @@ { FLUID_BOLUS_STATE_T state = FLUID_BOLUS_IN_PROGRESS_STATE; F32 bolusTargetVolume = (F32)getTreatmentParameterU32( TREATMENT_PARAM_FLUID_BOLUS_VOLUME ); - BOOL isDialysateGoodToDeliver = TRUE; // TODO: replace TRUE with getDialysateGoodToDeliverStatus() when we are ready updateFluidBolusVolumeDelivered(); @@ -383,7 +379,7 @@ } else { - if ( FALSE == isDialysateGoodToDeliver ) + if ( FALSE == getDialysateGoodToDeliverStatus() ) { state = FLUID_BOLUS_IDLE_STATE; } Index: firmware/App/Services/StateServices/TubeSetAutoEject.h =================================================================== diff -u -r9cc543b1c2508280767573e20eddd94e68be1fb5 -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Services/StateServices/TubeSetAutoEject.h (.../TubeSetAutoEject.h) (revision 9cc543b1c2508280767573e20eddd94e68be1fb5) +++ firmware/App/Services/StateServices/TubeSetAutoEject.h (.../TubeSetAutoEject.h) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -35,25 +35,25 @@ /// Enumeration of Tube Set Auto-Eject states. enum Tube_Set_Auto_Eject_States { - TUBE_SET_AUTO_EJECT_STATE_AWAIT_CONFIRMATION = 0, // Waiting for user confirmation to auto-eject - TUBE_SET_AUTO_EJECT_STATE_HOMING, // Homing blood pump - TUBE_SET_AUTO_EJECT_STATE_EXTENDING_EJECTOR, // Extending ejector state - TUBE_SET_AUTO_EJECT_STATE_EJECTING, // Ejecting tubeset state - TUBE_SET_AUTO_EJECT_STATE_RETRACTING_EJECTOR, // Retracting ejector state - TUBE_SET_AUTO_EJECT_STATE_BACK_OFF, // Auto-Eject Back-off state - TUBE_SET_AUTO_EJECT_STATE_COMPLETE, // Auto-Eject complete state - NUM_OF_TUBE_SET_AUTO_EJECT_SUB_STATES, // Num of auto-eject sub-states + TUBE_SET_AUTO_EJECT_STATE_AWAIT_CONFIRMATION = 0, ///< Waiting for user confirmation to auto-eject + TUBE_SET_AUTO_EJECT_STATE_HOMING, ///< Homing blood pump + TUBE_SET_AUTO_EJECT_STATE_EXTENDING_EJECTOR, ///< Extending ejector state + TUBE_SET_AUTO_EJECT_STATE_EJECTING, ///< Ejecting tubeset state + TUBE_SET_AUTO_EJECT_STATE_RETRACTING_EJECTOR, ///< Retracting ejector state + TUBE_SET_AUTO_EJECT_STATE_BACK_OFF, ///< Auto-Eject Back-off state + TUBE_SET_AUTO_EJECT_STATE_COMPLETE, ///< Auto-Eject complete state + NUM_OF_TUBE_SET_AUTO_EJECT_SUB_STATES, ///< Num of auto-eject sub-states }; /// Type for TD Tube Set Auto-Eject service enumeration typedef enum Tube_Set_Auto_Eject_States TUBE_SET_AUTO_EJECT_STATE_T; // ********** public function prototypes ********** -void initTubeSetAutoEject( void ); // Initialize this service -void execTubeSetAutoEject( void ); // Execute the service state machine (call from ModePostTreat and ModeTreatment) +void initTubeSetAutoEject( void ); ///< Initialize this service +void execTubeSetAutoEject( void ); ///< Execute the service state machine (call from ModePostTreat and ModeTreatment) -BOOL isTubeSetAutoEjectComplete( void ); // Returns True once auto-eject finished successfully -BOOL handleAutoEjectRequest( MESSAGE_T *message ); // Handle UI auto-eject confirmation request +BOOL isTubeSetAutoEjectComplete( void ); ///< Returns True once auto-eject finished successfully +BOOL handleAutoEjectRequest( MESSAGE_T *message ); ///< Handle UI auto-eject confirmation request /**@}*/ Index: firmware/App/Services/StateServices/TubeSetInstall.c =================================================================== diff -u -r0b025cea0b0f290ea44714a8fae6d71ea05088b9 -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 0b025cea0b0f290ea44714a8fae6d71ea05088b9) +++ firmware/App/Services/StateServices/TubeSetInstall.c (.../TubeSetInstall.c) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -75,7 +75,7 @@ bloodPumpTimerCounter = 0; bpLastHome = TRUE; bpLeftHomeTimerCounter = 0; - currentTubeSetType = TUBE_SET_TYPE_HD; // TODO: Call setTubeSetType() when barcode scanning is implemented. + currentTubeSetType = TUBE_SET_TYPE_UNKNOWN; } /*********************************************************************//** @@ -345,7 +345,14 @@ *************************************************************************/ void setTubeSetType( TUBE_SET_TYPE_T type ) { - currentTubeSetType = type; + if ( type < NUM_OF_TUBE_SET_TYPES ) + { + currentTubeSetType = type; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_TUBE_SET_TYPE, (U32)type ); + } } /*********************************************************************//** Index: firmware/App/Services/StateServices/TubeSetInstall.h =================================================================== diff -u -r0b025cea0b0f290ea44714a8fae6d71ea05088b9 -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Services/StateServices/TubeSetInstall.h (.../TubeSetInstall.h) (revision 0b025cea0b0f290ea44714a8fae6d71ea05088b9) +++ firmware/App/Services/StateServices/TubeSetInstall.h (.../TubeSetInstall.h) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -32,29 +32,29 @@ // ********** public definitions ********** -///< Enumeration of Tube Set install sub-states. +/// Enumeration of Tube Set install sub-states. enum Tube_Set_Install_States { - TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION = 0, // Awaiting user confirmation that tubeset is placed. - TUBE_SET_INSTALL_STATE_AWAIT_BP_DOOR_CLOSE, // Waiting for blood pump door to be closed. - TUBE_SET_INSTALL_STATE_AUTO_LOAD, // Auto-Load the tubeset state - TUBE_SET_INSTALL_STATE_AUTO_LOAD_BACK_OFF, // Auto-Load Back-off state - TUBE_SET_INSTALL_STATE_COMPLETE, // Install state complete - NUM_OF_TUBE_SET_INSTALL_SUB_STATES, // Num of install sub-states + TUBE_SET_INSTALL_STATE_AWAIT_TUBE_SET_CONFIRMATION = 0, ///< Awaiting user confirmation that tubeset is placed. + TUBE_SET_INSTALL_STATE_AWAIT_BP_DOOR_CLOSE, ///< Waiting for blood pump door to be closed. + TUBE_SET_INSTALL_STATE_AUTO_LOAD, ///< Auto-Load the tubeset state + TUBE_SET_INSTALL_STATE_AUTO_LOAD_BACK_OFF, ///< Auto-Load Back-off state + TUBE_SET_INSTALL_STATE_COMPLETE, ///< Install state complete + NUM_OF_TUBE_SET_INSTALL_SUB_STATES, ///< Num of install sub-states }; -///< Type for tube set install states enumeration +/// Type for tube set install states enumeration typedef enum Tube_Set_Install_States TUBE_SET_INSTALL_STATE_T; // ********** public function prototypes ********** -void initTubeSetInstall( void ); // Initialize this service -void execTubeSetInstall( void ); // Execute the service state machine (call from ModePreTreat and ModeTreatment) +void initTubeSetInstall( void ); ///< Initialize this service +void execTubeSetInstall( void ); ///< Execute the service state machine (call from ModePreTreat and ModeTreatment) -BOOL isTubeSetInstallComplete( void ); // Returns True once auto-load finished successfully -BOOL handleAutoLoadRequest( MESSAGE_T *message ); // Handle UI auto-load confirmation request +BOOL isTubeSetInstallComplete( void ); ///< Returns True once auto-load finished successfully +BOOL handleAutoLoadRequest( MESSAGE_T *message ); ///< Handle UI auto-load confirmation request -void setTubeSetType( TUBE_SET_TYPE_T type ); // Set the current installed tube set type -TUBE_SET_TYPE_T getTubeSetType( void ); // Get the current installed tube set type +void setTubeSetType( TUBE_SET_TYPE_T type ); ///< Set the current installed tube set type +TUBE_SET_TYPE_T getTubeSetType( void ); ///< Get the current installed tube set type /**@}*/