Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r30f049651877229042e3f8700c8596e5b9a1e0f4 -r92f7cf45960398664518966bfaa2199f287cf2bd --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 30f049651877229042e3f8700c8596e5b9a1e0f4) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 92f7cf45960398664518966bfaa2199f287cf2bd) @@ -56,6 +56,8 @@ #define OCCLUSION_THRESHOLD 25000 ///< Threshold above which an occlusion is detected. #define CARTRIDGE_LOADED_THRESHOLD 5000 ///< Threshold above which a cartridge is considered loaded. +#define EMPTY_SALINE_BAG_THRESHOLD_MMGH -200.0 ///< Threshold below which the saline bag is considered empty (in mmHg). TODO - get real threshold from Systems + #define PRES_ALARM_PERSISTENCE ( 1 * MS_PER_SECOND ) ///< Alarm persistence period for pressure alarms. /// Defined states for the pressure and occlusion monitor state machine. @@ -151,6 +153,28 @@ return result; } +/*********************************************************************//** + * @brief + * The isSalineBagEmpty function determines whether the saline bag is empty. + * It is assumed that this function will only be called when pumping (BP) from + * the saline bag. Determination is based on pressure going below a negative + * threshold. + * @details Inputs: arterial line pressure + * @details Outputs: none + * @return TRUE if arterial line pressure is below threshold, FALSE if not. + *************************************************************************/ +BOOL isSalineBagEmpty( void ) +{ + BOOL result = FALSE; + + if ( getMeasuredArterialPressure() < EMPTY_SALINE_BAG_THRESHOLD_MMGH ) + { + result = TRUE; + } + + return result; +} + /*********************************************************************//** * @brief * The execPresOccl function executes the pressure and occlusion monitor. Index: firmware/App/Controllers/PresOccl.h =================================================================== diff -u -r30f049651877229042e3f8700c8596e5b9a1e0f4 -r92f7cf45960398664518966bfaa2199f287cf2bd --- firmware/App/Controllers/PresOccl.h (.../PresOccl.h) (revision 30f049651877229042e3f8700c8596e5b9a1e0f4) +++ firmware/App/Controllers/PresOccl.h (.../PresOccl.h) (revision 92f7cf45960398664518966bfaa2199f287cf2bd) @@ -72,6 +72,7 @@ U32 getMeasuredDialOutPumpOcclusion( void ); BOOL isCartridgeLoaded( void ); +BOOL isSalineBagEmpty( void ); BOOL testSetPresOcclDataPublishIntervalOverride( U32 value ); BOOL testResetPresOcclDataPublishIntervalOverride( void ); Index: firmware/App/HDCommon.h =================================================================== diff -u -r778f343622819491cf644dab36f3194709ce1e95 -r92f7cf45960398664518966bfaa2199f287cf2bd --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 778f343622819491cf644dab36f3194709ce1e95) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 92f7cf45960398664518966bfaa2199f287cf2bd) @@ -41,17 +41,17 @@ #define DISABLE_AIR_TRAP_LEVELING 1 // Disable air trap level control // #define DISABLE_3WAY_VALVES 1 // Disable 3-way valves // #define TST_3WAY_VALVES_ALWAYS_OPEN 1 // After POST and homing, open all 4 valves - #define DISABLE_ACCELS 1 // Disable accelerometer POST and monitoring - #define DISABLE_CRC_ERROR 1 // Do not error on bad CRC for CAN messages - #define DISABLE_ACK_ERRORS 1 // Do not error on failure of other node(s) to ACK a message - #define DISABLE_MOTOR_CURRENT_CHECKS 1 // Do not error on HD pump current checks - #define DISABLE_PUMP_FLOW_CHECKS 1 // Do not error on HD pump flow checks - #define DISABLE_PUMP_SPEED_CHECKS 1 // Do not error on HD pump speed checks - #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks - #define DISABLE_SALINE_BOLUS_CHECKS 1 // Do not error on HD saline bolus checks - #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks - #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks - #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position +// #define DISABLE_ACCELS 1 // Disable accelerometer POST and monitoring +// #define DISABLE_CRC_ERROR 1 // Do not error on bad CRC for CAN messages +// #define DISABLE_ACK_ERRORS 1 // Do not error on failure of other node(s) to ACK a message +// #define DISABLE_MOTOR_CURRENT_CHECKS 1 // Do not error on HD pump current checks +// #define DISABLE_PUMP_FLOW_CHECKS 1 // Do not error on HD pump flow checks +// #define DISABLE_PUMP_SPEED_CHECKS 1 // Do not error on HD pump speed checks +// #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks +// #define DISABLE_SALINE_BOLUS_CHECKS 1 // Do not error on HD saline bolus checks +// #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks +// #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks +// #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position // #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // #define RAW_FLOW_SENSOR_DATA 1 // Test build will not filter flow sensor data // #define READ_FPGA_ASYNC_DATA 1 // Test build reads non-priority register page every other time Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -r92f7cf45960398664518966bfaa2199f287cf2bd --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 92f7cf45960398664518966bfaa2199f287cf2bd) @@ -936,10 +936,10 @@ bolusSalineVolumeDelivered_Safety = ( (F32)bolusSalineMotorCount * VOLUME_PER_BP_MOTOR_REV_ML ); // TODO - include upstream pressure compensation to this calc #ifndef DISABLE_SALINE_BOLUS_CHECKS - // TODO - check for empty saline bag - if ( 0 ) + // Check for empty saline bag per arterial line pressure TODO - need persistence? + if ( TRUE == isSalineBagEmpty() ) { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_EMPTY_SALINE_BAG, 0.0 ); // TODO - give data supporting empty bag detection + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_EMPTY_SALINE_BAG, getMeasuredArterialPressure() ); errorFound = TRUE; } #endif