Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r563f516a81cb41290008f93b33e7cf5e121717db -rc05775820109b5e83596c58a3b4248ac6cdb1d65 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 563f516a81cb41290008f93b33e7cf5e121717db) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision c05775820109b5e83596c58a3b4248ac6cdb1d65) @@ -114,6 +114,8 @@ #define BLOOD_FLOW_FAST_READ_TO_PERSIST 100 /// Blood flow slow read timeout alarm persistence. #define BLOOD_FLOW_SLOW_READ_TO_PERSIST ( MS_PER_SECOND * 3 ) +/// Blood flow comm error persistence. +#define BLOOD_FLOW_COMM_ERROR_PERSIST MS_PER_SECOND #define BFM_SENSOR_CONNECTED_STATUS 0x00 ///< Blood flow meter connected status. #define BFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Blood flow meter NVM parameter status. @@ -191,16 +193,17 @@ static U32 errorBloodPumpDirectionPersistTimerCtr = 0; ///< Persistence timer counter for pump direction error condition. static U32 errorBloodPumpRotorTooFastPersistTimerCtr = 0; ///< Persistence timer counter for pump rotor too fast error condition. -static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average -static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array -static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average -static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer +static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average. +static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array. +static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average. +static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer. -static U32 bpCurrErrorDurationCtr = 0; ///< Used for tracking persistence of bp current errors +static U32 bpCurrErrorDurationCtr = 0; ///< Used for tracking persistence of bp current errors. -static U08 lastBloodFlowFastPacketReadCtr = 0; ///< Previous read counter for the blood flow fast packets -static U08 lastBloodFlowSlowPacketReadCtr = 0; ///< Previous read counter for the blood flow slow packets -static U08 lastBloodPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA +static U08 lastBloodFlowFastPacketReadCtr = 0; ///< Previous read counter for the blood flow fast packets. +static U08 lastBloodFlowSlowPacketReadCtr = 0; ///< Previous read counter for the blood flow slow packets. +static U08 lastBloodPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA. +static U08 lastBloodFlowCommErrorCount = 0; ///< Previous BP flow sensor comm error count. // ********** private function prototypes ********** @@ -257,6 +260,7 @@ initPersistentAlarm( ALARM_ID_BLOOD_FLOW_SIGNAL_STRENGTH_TOO_LOW, FLOW_SIG_STRGTH_ALARM_PERSIST, FLOW_SIG_STRGTH_ALARM_PERSIST ); initPersistentAlarm( ALARM_ID_HD_BP_FLOW_READ_TIMEOUT_ERROR, 0, BLOOD_FLOW_FAST_READ_TO_PERSIST ); initPersistentAlarm( ALARM_ID_HD_BP_FLOW_SLOW_READ_TIMEOUT_ERROR, 0, BLOOD_FLOW_SLOW_READ_TO_PERSIST ); + initPersistentAlarm( ALARM_ID_HD_BP_FLOW_SENSOR_ERROR, 0, BLOOD_FLOW_COMM_ERROR_PERSIST ); } /*********************************************************************//** @@ -451,10 +455,15 @@ U08 flowStatus = getFPGABloodFlowMeterStatus(); #ifndef DISABLE_PUMP_FLOW_CHECKS + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BP_FLOW_SENSOR_ERROR, ( flowErrorCtr != lastBloodFlowCommErrorCount ) ) ) + { + activateAlarmNoData( ALARM_ID_HD_BP_FLOW_SENSOR_ERROR ); + } if ( flowStatus != BFM_SENSOR_CONNECTED_STATUS ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BLOOD_FLOW_STATUS_SELF_TEST_FAILURE, (U32)flowStatus ); } + lastBloodFlowCommErrorCount = flowErrorCtr; #endif #ifndef DISABLE_FPGA_COUNTER_CHECKS @@ -501,7 +510,6 @@ // Publish blood flow data on interval publishBloodFlowData(); } -//ALARM_ID_HD_BP_FLOW_SENSOR_ERROR = 208, ///< HD blood flow sensor error /*********************************************************************//** * @brief Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r326e3597e1555ef2ac4978f58786e7ce638b1287 -rc05775820109b5e83596c58a3b4248ac6cdb1d65 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 326e3597e1555ef2ac4978f58786e7ce638b1287) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision c05775820109b5e83596c58a3b4248ac6cdb1d65) @@ -116,6 +116,8 @@ #define DIALYSATE_FLOW_FAST_READ_TO_PERSIST 100 /// Dialysate flow slow read timeout alarm persistence. #define DIALYSATE_FLOW_SLOW_READ_TO_PERSIST ( MS_PER_SECOND * 3 ) +/// Blood flow comm error persistence. +#define DIALYSATE_FLOW_COMM_ERROR_PERSIST MS_PER_SECOND #define DFM_SENSOR_CONNECTED_STATUS 0x00 ///< Dialysate flow meter connected status. #define DFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Dialysate flow meter NVM parameter corrupt status. @@ -190,16 +192,17 @@ static U32 errorDialInRotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for rotor speed error condition. static U32 errorDialInPumpDirectionPersistTimerCtr = 0; ///< Persistence timer counter for pump direction error condition. -static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average -static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array -static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average -static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer +static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average. +static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array. +static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average. +static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer. -static U32 dipCurrErrorDurationCtr = 0; ///< Used for tracking persistence of dip current errors +static U32 dipCurrErrorDurationCtr = 0; ///< Used for tracking persistence of dip current errors. -static U08 lastDialysateFlowFastPacketReadCtr = 0; ///< Previous read counter for the dialysate flow fast packets -static U08 lastDialysateFlowSlowPacketReadCtr = 0; ///< Previous read counter for the dialysate flow slow packets -static U08 lastDialInPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA +static U08 lastDialysateFlowFastPacketReadCtr = 0; ///< Previous read counter for the dialysate flow fast packets. +static U08 lastDialysateFlowSlowPacketReadCtr = 0; ///< Previous read counter for the dialysate flow slow packets. +static U08 lastDialInPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA. +static U08 lastDialysateFlowCommErrorCount = 0; ///< Previous DPi flow sensor comm error count. // ********** private function prototypes ********** @@ -256,6 +259,7 @@ initPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_SIGNAL_STRENGTH_TOO_LOW, FLOW_SIG_STRGTH_ALARM_PERSIST, FLOW_SIG_STRGTH_ALARM_PERSIST ); initPersistentAlarm( ALARM_ID_HD_DP_FLOW_READ_TIMEOUT_ERROR, 0, DIALYSATE_FLOW_FAST_READ_TO_PERSIST ); initPersistentAlarm( ALARM_ID_HD_DP_FLOW_SLOW_READ_TIMEOUT_ERROR, 0, DIALYSATE_FLOW_SLOW_READ_TO_PERSIST ); + initPersistentAlarm( ALARM_ID_HD_DP_FLOW_SENSOR_ERROR, 0, DIALYSATE_FLOW_COMM_ERROR_PERSIST ); } /*********************************************************************//** @@ -421,10 +425,15 @@ U08 flowStatus = getFPGADialysateFlowMeterStatus(); #ifndef DISABLE_PUMP_FLOW_CHECKS + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_DP_FLOW_SENSOR_ERROR, ( flowErrorCtr != lastDialysateFlowCommErrorCount ) ) ) + { + activateAlarmNoData( ALARM_ID_HD_DP_FLOW_SENSOR_ERROR ); + } if ( flowStatus != DFM_SENSOR_CONNECTED_STATUS ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_DIALYSATE_FLOW_STATUS_SELF_TEST_FAILURE, (U32)flowStatus ); } + lastDialysateFlowCommErrorCount = flowErrorCtr; #endif #ifndef DISABLE_FPGA_COUNTER_CHECKS @@ -471,7 +480,6 @@ // Publish dialIn flow data on interval publishDialInFlowData(); } -//ALARM_ID_HD_DP_FLOW_SENSOR_ERROR = 210, ///< HD dialysate flow sensor error /*********************************************************************//** * @brief Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r7bbf1fb04f7e4788c3072ca173413ed052c608d3 -rc05775820109b5e83596c58a3b4248ac6cdb1d65 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 7bbf1fb04f7e4788c3072ca173413ed052c608d3) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision c05775820109b5e83596c58a3b4248ac6cdb1d65) @@ -104,10 +104,13 @@ static U32 emptySalineBagCtr = 0; ///< Timer counter for empty bag detection. -static U08 lastVenousPressureReadCtr; ///< Previous venous pressure read counter. -static U08 lastBPOcclReadCtr; ///< Previous BP occlusion read counter. -static U08 lastDPiOcclReadCtr; ///< Previous DPi occlusion read counter. -static U08 lastDPoOcclReadCtr; ///< Previous DPo occlusion read counter. +static U08 lastVenousPressureReadCtr; ///< Previous venous pressure read count. +static U08 lastBPOcclReadCtr; ///< Previous BP occlusion read count. +static U08 lastDPiOcclReadCtr; ///< Previous DPi occlusion read count. +static U08 lastDPoOcclReadCtr; ///< Previous DPo occlusion read count. +static U08 lastBPErrorCtr; ///< Previous BP error count. +static U08 lastDPIErrorCtr; ///< Previous DPi error count. +static U08 lastDPOErrorCtr; ///< Previous DPo error count. // ********** private function prototypes ********** @@ -140,11 +143,17 @@ initPersistentAlarm( ALARM_ID_HD_BP_OCCLUSION_READ_TIMEOUT_ERROR, 0, PRES_ALARM_PERSISTENCE ); initPersistentAlarm( ALARM_ID_HD_DPI_OCCLUSON_READ_TIMEOUT_ERROR, 0, PRES_ALARM_PERSISTENCE ); initPersistentAlarm( ALARM_ID_HD_DPO_OCCLUSION_READ_TIMEOUT_ERROR, 0, PRES_ALARM_PERSISTENCE ); + initPersistentAlarm( ALARM_ID_HD_BP_OCCLUSION_SENSOR_ERROR, 0, PRES_ALARM_PERSISTENCE ); + initPersistentAlarm( ALARM_ID_HD_DPI_OCCLUSION_SENSOR_ERROR, 0, PRES_ALARM_PERSISTENCE ); + initPersistentAlarm( ALARM_ID_HD_DPO_OCCLUSION_SENSOR_ERROR, 0, PRES_ALARM_PERSISTENCE ); lastVenousPressureReadCtr = 0; lastBPOcclReadCtr = 0; lastDPiOcclReadCtr = 0; lastDPoOcclReadCtr = 0; + lastBPErrorCtr = 0; + lastDPIErrorCtr = 0; + lastDPOErrorCtr = 0; } /*********************************************************************//** @@ -325,7 +334,7 @@ else { #ifndef DISABLE_PRESSURE_CHECKS - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT, (U32)venPresStatus ) // TODO - persistence? +// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_VENOUS_PRESSURE_SENSOR_FAULT, (U32)venPresStatus ) // TODO - persistence? YES, need persistence - getting a stale data status. OR maybe speed up ADC in FPGA. #endif } @@ -353,17 +362,16 @@ U08 dpiErrorCtr = getFPGADialInPumpOcclusionErrorCounter(); U08 dpoErrorCtr = getFPGADialOutPumpOcclusionErrorCounter(); -#ifndef DISABLE_FPGA_COUNTER_CHECKS // Check for sensor errors - if ( bpErrorCtr > 0 ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BP_OCCLUSION_SENSOR_ERROR, ( bpErrorCtr != lastBPErrorCtr ) ) ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BP_OCCLUSION_SENSOR_ERROR, (U32)bpErrorCtr ) } - if ( dpiErrorCtr > 0 ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_DPI_OCCLUSION_SENSOR_ERROR, ( dpiErrorCtr != lastDPIErrorCtr ) ) ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_DPI_OCCLUSION_SENSOR_ERROR, (U32)dpiErrorCtr ) } - if ( dpoErrorCtr > 0 ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_DPO_OCCLUSION_SENSOR_ERROR, ( dpoErrorCtr != lastDPOErrorCtr ) ) ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_DPO_OCCLUSION_SENSOR_ERROR, (U32)dpoErrorCtr ) } @@ -381,17 +389,19 @@ { activateAlarmNoData( ALARM_ID_HD_DPO_OCCLUSION_READ_TIMEOUT_ERROR ); } -#endif // Record occlusion sensor readings bloodPumpOcclusion.data = (U32)getFPGABloodPumpOcclusion(); dialInPumpOcclusion.data = (U32)getFPGADialInPumpOcclusion(); dialOutPumpOcclusion.data = (U32)getFPGADialOutPumpOcclusion(); - // Record occlusion read counters for next time around + // Record occlusion read and error counters for next time around lastBPOcclReadCtr = bpReadCtr; lastDPiOcclReadCtr = dpiReadCtr; lastDPoOcclReadCtr = dpoReadCtr; + lastBPErrorCtr = bpErrorCtr; + lastDPIErrorCtr = dpiErrorCtr; + lastDPOErrorCtr = dpoErrorCtr; } /*********************************************************************//** Index: firmware/App/HDCommon.h =================================================================== diff -u -r563f516a81cb41290008f93b33e7cf5e121717db -rc05775820109b5e83596c58a3b4248ac6cdb1d65 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 563f516a81cb41290008f93b33e7cf5e121717db) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision c05775820109b5e83596c58a3b4248ac6cdb1d65) @@ -43,18 +43,18 @@ #define DISABLE_AIR_TRAP_LEVELING_ALARM 1 // Disable air trap level control alarms // #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_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_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_SYRINGE_PUMP 1 // Disable syringe pump functionality #define ALWAYS_ALLOW_SYRINGE_PUMP_CMDS 1 // Allow syringe pump commands at any time except when pump is busy - #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure 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_VALVE_ALARMS 1 // Do not error on HD valve position #define DISABLE_CAL_CHECK 1 // Disable calibration checks // #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 @@ -73,10 +73,10 @@ // #define DISABLE_BATT_COMM 1 // Disable battery communication. #define SKIP_AIR_BUBBLE_CHECK 1 // Skip air bubble detector self-test. #define DISABLE_OCCLUSION_SELF_TEST 1 // Skip occlusion sensor self-test. - #define DISABLE_FPGA_COUNTER_CHECKS 1 // Disable alarms associated with FPGA read/error counters - #define DISABLE_VOLTAGE_MONITOR 1 // Disable voltage monitoring/alarms +// #define DISABLE_FPGA_COUNTER_CHECKS 1 // Disable alarms associated with FPGA read/error counters +// #define DISABLE_VOLTAGE_MONITOR 1 // Disable voltage monitoring/alarms #define ALLOW_1_MIN_TREATMENT_DURATION 1 // Allow user to change treatment duration to as low as 1 minute - #define DISABLE_SYRINGE_PUMP_ALARMS 1 // Disable some syringe pump alarms that are triggering intermittently +// #define DISABLE_SYRINGE_PUMP_ALARMS 1 // Disable some syringe pump alarms that are triggering intermittently #include #include Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r10259cb982684bf10863cb4586a4214fcc3528a9 -rc05775820109b5e83596c58a3b4248ac6cdb1d65 --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 10259cb982684bf10863cb4586a4214fcc3528a9) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision c05775820109b5e83596c58a3b4248ac6cdb1d65) @@ -122,7 +122,6 @@ static void setupForSelfTestsStop( void ); static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestsWaitForClosedDoor( void ); -static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestLeakDetectorsState( void ); static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestHomeValvesState( void ); static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestHomeSyringePumpState( void ); static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestPumpsState( void ); @@ -265,13 +264,9 @@ // TODO: Use appropriate sensor driver setFPGASensorTest( BLOOD_LEAK_SELF_TEST_SET ); - currentNoCartSelfTestsState = NO_CART_SELF_TESTS_LEAK_DETECTORS_STATE; + currentNoCartSelfTestsState = NO_CART_SELF_TESTS_BOARD_TEMPERATURE_STATE; break; - case NO_CART_SELF_TESTS_LEAK_DETECTORS_STATE: - currentNoCartSelfTestsState = handleNoCartSelfTestLeakDetectorsState(); - break; - case NO_CART_SELF_TESTS_BOARD_TEMPERATURE_STATE: // TODO: Implement self tests currentNoCartSelfTestsState = NO_CART_SELF_TESTS_HOME_VALVES_STATE; @@ -595,39 +590,6 @@ /*********************************************************************//** * @brief - * The handleNoCartSelfTestLeakDetectorsState function verifies leak detectors status. - * @details Inputs: none - * @details Outputs: none - * @return the next state of no cartridge self-tests state machine - *************************************************************************/ -static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestLeakDetectorsState( void ) -{ - NO_CART_SELF_TESTS_STATE_T state = NO_CART_SELF_TESTS_LEAK_DETECTORS_STATE; - // TODO: Use appropriate sensor driver - BOOL const bloodLeakDetector = getFPGABloodLeakDetectorStatus(); - - if ( TRUE == bloodLeakDetector ) - { - // TODO: Use appropriate sensor driver - setFPGASensorTest( BLOOD_LEAK_NORMAL_OPERATION ); - state = NO_CART_SELF_TESTS_BOARD_TEMPERATURE_STATE; - } - else - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BLOOD_LEAK_SELF_TEST_FAILURE, (U32)bloodLeakDetector ); - } - - if ( TRUE == doesAlarmStatusIndicateStop() ) - { - setupForSelfTestsStop(); - state = NO_CART_SELF_TESTS_STOPPED_STATE; - } - - return state; -} - -/*********************************************************************//** - * @brief * The handleNoCartSelfTestHomeValvesState function starts homing process for * all the valves. * @details Inputs: none