Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r7bbf1fb04f7e4788c3072ca173413ed052c608d3 -r7334590e610cd1543e128ad2dbc0de17e824b619 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 7bbf1fb04f7e4788c3072ca173413ed052c608d3) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 7334590e610cd1543e128ad2dbc0de17e824b619) @@ -111,7 +111,6 @@ // ********** private function prototypes ********** -static PRESSURE_STATE_T handlePresOcclInitState( void ); static PRESSURE_STATE_T handlePresOcclContReadState( void ); static void convertInlinePressures( void ); static void convertOcclusionPressures( void ); @@ -162,8 +161,7 @@ U32 diOccl = getMeasuredDialInPumpOcclusion(); U32 doOccl = getMeasuredDialOutPumpOcclusion(); - if ( ( bpOccl >= CARTRIDGE_LOADED_THRESHOLD ) && - ( diOccl >= CARTRIDGE_LOADED_THRESHOLD ) && + if ( ( bpOccl >= CARTRIDGE_LOADED_THRESHOLD ) && ( diOccl >= CARTRIDGE_LOADED_THRESHOLD ) && ( doOccl >= CARTRIDGE_LOADED_THRESHOLD ) ) { result = TRUE; @@ -174,6 +172,23 @@ /*********************************************************************//** * @brief + * The isCartridgeUnloaded function determines if a cartridge has been + * unloaded by looking at the 3 occlusion pressure sensors. + * @details Inputs: occlusion pressures for the pumps + * @details Outputs: none + * @return TRUE if all 3 occlusion sensors read below loaded threshold, FALSE if not. + *************************************************************************/ +BOOL isCartridgeUnloaded( void ) +{ + BOOL const bpOcclBelowLoadedThreshold = getMeasuredBloodPumpOcclusion() <= CARTRIDGE_LOADED_THRESHOLD; + BOOL const diOcclBelowLoadedThreshold = getMeasuredDialInPumpOcclusion() <= CARTRIDGE_LOADED_THRESHOLD; + BOOL const doOcclBelowLoadedThreshold = getMeasuredDialOutPumpOcclusion() <= CARTRIDGE_LOADED_THRESHOLD; + + return ( bpOcclBelowLoadedThreshold && diOcclBelowLoadedThreshold && doOcclBelowLoadedThreshold ); +} + +/*********************************************************************//** + * @brief * The isSalineBagEmpty function determines whether the saline bag is empty. * It is assumed that this function will only be called from mode handling * (General Task) when pumping (BP) from the saline bag. @@ -214,7 +229,7 @@ switch ( presOcclState ) { case PRESSURE_INIT_STATE: - presOcclState = handlePresOcclInitState(); + presOcclState = PRESSURE_CONTINUOUS_READ_STATE; break; case PRESSURE_CONTINUOUS_READ_STATE: @@ -232,21 +247,6 @@ /*********************************************************************//** * @brief - * The handlePresOcclInitState function handles the initialize state - * of the pressure/occlusion monitor state machine. - * @details Inputs: TBD - * @details Outputs: TBD - * @return next state - *************************************************************************/ -static PRESSURE_STATE_T handlePresOcclInitState( void ) -{ - PRESSURE_STATE_T result = PRESSURE_CONTINUOUS_READ_STATE; - - return result; -} - -/*********************************************************************//** - * @brief * The handlePresOcclContReadState function handles the continuous read state * of the pressure/occlusion monitor state machine. * @details Inputs: FPGA pressure/occlusion readings