Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -182,9 +182,11 @@ if ( ( AIR_TRAP_LEVEL_AIR == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_LOWER ) ) && ( AIR_TRAP_LEVEL_FLUID == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_UPPER ) ) ) { - if ( ++airTrapIllegalLevelSensorsCtr >= AIR_TRAP_ILLEGAL_LEVELS_PERSISTENCE ) + if ( ( ++airTrapIllegalLevelSensorsCtr >= AIR_TRAP_ILLEGAL_LEVELS_PERSISTENCE ) && + ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ILLEGAL_AIR_TRAP_ALARM ) ) != SW_CONFIG_ENABLE_VALUE ) { #ifndef DISABLE_ILLEGAL_AIR_TRAP_ALARM + activateAlarmNoData( ALARM_ID_AIR_TRAP_ILLEGAL_LEVELS ); #endif } Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -123,7 +123,7 @@ #define BP_FLOW_WEAR_A_TERM 0.000000001 ///< A term used for wear portion of alpha flow coefficient. #define BP_FLOW_WEAR_B_TERM 0.00055 ///< B term used for wear portion of alpha flow coefficient. #define BP_MAX_ROTOR_COUNT_FOR_WEAR 25000 ///< Maximum rotor count for determining wear of the cartridge (negligible affect beyond this threshold). -#define DATA_PUBLISH_COUNTER_START_COUNT 9 ///< Data publish counter start count. +#define DATA_PUBLISH_COUNTER_START_COUNT 20 ///< Data publish counter start count. /// Enumeration of blood pump controller states. typedef enum BloodPump_States Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -58,6 +58,8 @@ #define BLOOD_LEAK_MIN_WAIT_TIME_2_GET_CAL_MS ( 2 * MS_PER_SECOND ) ///< Blood leak minimum wait time to get calibration in milliseconds. +#define DATA_PUBLISH_COUNTER_START_COUNT 60 ///< Data publish counter start count. + /// Defined states for the blood leak detector state machine. typedef enum BloodLeakStates { @@ -88,7 +90,7 @@ static OVERRIDE_U32_T bloodLeakDataPublishInterval = { BLOOD_LEAK_PUB_INTERVAL, BLOOD_LEAK_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish blood leak data to CAN bus. -static U32 bloodLeakDataPublicationTimerCounter = 0; ///< Timer counter used to schedule blood leak data publication to CAN bus. +static U32 bloodLeakDataPublicationTimerCounter; ///< Timer counter used to schedule blood leak data publication to CAN bus. static U32 bloodLeakUARTCmdIndex = 0; ///< Blood leak UART command index. static U32 bloodLeakSetPointSeqLength = 0; ///< Blood leak set point sequence actual length. static U08 bloodLeakSetPointSequence[ BLOOD_LEAK_SET_POINT_SEQ_MAX_LENGTH ]; ///< Blood leak set point sequence array. @@ -135,7 +137,7 @@ *************************************************************************/ void initBloodLeak( void ) { - bloodLeakDataPublicationTimerCounter = 0; + bloodLeakDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; bloodLeakState = BLOOD_LEAK_WAIT_FOR_POST_STATE; bloodLeakStatus.data = BLOOD_LEAK_NOT_DETECTED; bloodLeakStatus.ovInitData = BLOOD_LEAK_NOT_DETECTED; Index: firmware/App/Controllers/Bubble.c =================================================================== diff -u -r61716bc97ecca8af1ec560333844a8cf602eccb0 -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/Bubble.c (.../Bubble.c) (revision 61716bc97ecca8af1ec560333844a8cf602eccb0) +++ firmware/App/Controllers/Bubble.c (.../Bubble.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -30,8 +30,9 @@ // ********** private definitions ********** -#define BUBBLE_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the air bubble detector data is published on the CAN bus. -#define BUBBLE_TIMEOUT_MS 500 ///< Air bubble detector timeout for self-test (15 ms extended edge detection) +#define BUBBLE_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the air bubble detector data is published on the CAN bus. +#define BUBBLE_TIMEOUT_MS 500 ///< Air bubble detector timeout for self-test (15 ms extended edge detection) +#define DATA_PUBLISH_COUNTER_START_COUNT 70 ///< Data publish counter start count. /// Defined states for the air bubble detectors state machine. typedef enum BubbleStates @@ -83,6 +84,8 @@ bubblesSelfTestRequested[ bubble ] = FALSE; bubblesSelfTestStartTime[ bubble ] = 0; } + + bubblesDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; } /*********************************************************************//** @@ -194,41 +197,44 @@ } #ifndef DISABLE_BUBBLE_ALARMS - // Check status reading and act upon - if ( BUBBLE_DETECTED == getBubbleStatus( bubble ) ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_BUBBLE_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) { - if ( getCurrentOperationMode() == MODE_TREA ) + // Check status reading and act upon + if ( BUBBLE_DETECTED == getBubbleStatus( bubble ) ) { - switch ( treatmentState ) + if ( getCurrentOperationMode() == MODE_TREA ) { - case TREATMENT_BLOOD_PRIME_STATE: - case TREATMENT_DIALYSIS_STATE: - case TREATMENT_END_STATE: - if ( bubble == ADV ) - { - activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); - } - break; + switch ( treatmentState ) + { + case TREATMENT_BLOOD_PRIME_STATE: + case TREATMENT_DIALYSIS_STATE: + case TREATMENT_END_STATE: + if ( bubble == ADV ) + { + activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); + } + break; - case TREATMENT_RINSEBACK_STATE: - if ( bubble == ADV ) - { - activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); - } - break; + case TREATMENT_RINSEBACK_STATE: + if ( bubble == ADV ) + { + activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); + } + break; - default: - // Ignore other treatment states - break; + default: + // Ignore other treatment states + break; + } } } - } - else // Air bubble not detected - { - if ( bubble == ADV ) + else // Air bubble not detected { - clearAlarmCondition( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); - clearAlarmCondition( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); + if ( bubble == ADV ) + { + clearAlarmCondition( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); + clearAlarmCondition( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); + } } } #endif Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r6623684ddacf5beebd15bce8a1dbd06a442fb38e -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 6623684ddacf5beebd15bce8a1dbd06a442fb38e) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -911,24 +911,27 @@ BOOL const dialysateTempRecovered = fabs( dgDialysateTemp - dgTrimmerTempSet ) < DIALYSATE_TEMP_RECOVERY_TOLERANCE_C ? TRUE : FALSE; #ifndef DISABLE_DIALYSATE_TEMP_CHECK - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dialysateHighTemp ) ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DIALYSATE_TEMP_CHECK ) != SW_CONFIG_ENABLE_VALUE ) { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dgTrimmerTempSet, dgDialysateTemp ); - } + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dialysateHighTemp ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dgTrimmerTempSet, dgDialysateTemp ); + } - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dialysateLowTemp ) ) - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dgTrimmerTempSet, dgDialysateTemp ); - } + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dialysateLowTemp ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dgTrimmerTempSet, dgDialysateTemp ); + } - if ( TRUE == isPersistentAlarmConditionCleared( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dialysateHighTemp ) ) - { - clearAlarmCondition( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH ); - } + if ( TRUE == isPersistentAlarmConditionCleared( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dialysateHighTemp ) ) + { + clearAlarmCondition( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH ); + } - if ( TRUE == isPersistentAlarmConditionCleared( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dialysateTempRecovered ) ) - { - clearAlarmCondition( ALARM_ID_DIALYSATE_TEMPERATURE_LOW ); + if ( TRUE == isPersistentAlarmConditionCleared( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dialysateTempRecovered ) ) + { + clearAlarmCondition( ALARM_ID_DIALYSATE_TEMPERATURE_LOW ); + } } #endif } Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -116,7 +116,7 @@ #define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. -#define DATA_PUBLISH_COUNTER_START_COUNT 5 ///< Data publish counter start count. +#define DATA_PUBLISH_COUNTER_START_COUNT 30 ///< Data publish counter start count. /// Enumeration of dialysate inlet pump states. typedef enum DialInPump_States Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -109,7 +109,7 @@ #define DOP_PWM_TO_MOTOR_SPEED_RPM(pwm) ( ((pwm) - DOP_PWM_ZERO_OFFSET) * 4000.0 ) #define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. -#define DATA_PUBLISH_COUNTER_START_COUNT 6 ///< Data publish counter start count. +#define DATA_PUBLISH_COUNTER_START_COUNT 40 ///< Data publish counter start count. /// Enumeration of dialysate outlet pump controller states. typedef enum DialOutPump_States Index: firmware/App/Controllers/FluidLeak.c =================================================================== diff -u -r24b2fe72608344e67ef37234085d15ad5e4fcc37 -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/FluidLeak.c (.../FluidLeak.c) (revision 24b2fe72608344e67ef37234085d15ad5e4fcc37) +++ firmware/App/Controllers/FluidLeak.c (.../FluidLeak.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -30,7 +30,8 @@ // ********** private definitions ********** -#define FLUID_LEAK_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the fluid leak data is published on the CAN bus. +#define FLUID_LEAK_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the fluid leak data is published on the CAN bus. +#define DATA_PUBLISH_COUNTER_START_COUNT 50 ///< Data publish counter start count. // ********** private data ********** @@ -57,6 +58,7 @@ fluidLeakState.ovInitData = FLUID_LEAK_STATE_DRY; fluidLeakState.ovData = FLUID_LEAK_STATE_DRY; fluidLeakState.override = OVERRIDE_RESET; + fluidLeakStatePublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; } /*********************************************************************//** Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -48,6 +48,11 @@ #define VENOUS_PRESSURE_MAX_PSI ( 30.0 ) ///< Maximum of scale for venous pressure sensor reading (in PSI). #define MIN_VENOUS_PRESSURE_FOR_RAMP_MMHG ( 0.0 ) ///< Minimum venous pressure during blood pump ramp up (in mmHg). +#define ARTERIAL_PRESSURE_OFFSET ( 1638 ) ///< Offset for 14-bit arterial pressure sensor reading. +#define ARTERIAL_PRESSURE_SCALE ( 14745 - VENOUS_PRESSURE_OFFSET ) ///< Scale for arterial pressure sensor. +#define ARTERIAL_PRESSURE_MIN_PSI ( -30.0 ) ///< Minimum of scale for arterial pressure sensor reading (in PSI). +#define ARTERIAL_PRESSURE_MAX_PSI ( 30.0 ) ///< Maximum of scale for arterial pressure sensor reading (in PSI). + #define ARTERIAL_PRESSURE_SELF_TEST_MIN ( -300.0 ) ///< Minimum self-test value for arterial pressure sensor reading (in mmHg). #define ARTERIAL_PRESSURE_SELF_TEST_MAX ( 100.0 ) ///< Maximum self-test value for arterial pressure sensor reading (in mmHg). #define ARTERIAL_PRESSURE_MAX_MMHG ( 2000.0 ) ///< Maximum arterial pressure reading (in mmHg) for range check. @@ -70,6 +75,12 @@ #define VENOUS_PRESSURE_STALE_DATA 2 ///< Venous pressure status bits indicate data is stale (no new data since last fpga read). #define VENOUS_PRESSURE_DIAG_CONDITION 3 ///< Venous pressure status bits diagnostic condition (alarm). +// The new arterial pressure sensor is the same as the venous pressure sensor +#define ARTERIAL_PRESSURE_NORMAL_OP 0 ///< Arterial pressure status bits indicate normal operation. +#define ARTERIAL_PRESSURE_CMD_MODE 1 ///< Arterial pressure status bits indicate sensor in command mode. +#define ARTERIAL_PRESSURE_STALE_DATA 2 ///< Arterial pressure status bits indicate data is stale (no new data since last fpga read). +#define ARTERIAL_PRESSURE_DIAG_CONDITION 3 ///< Arterial pressure status bits diagnostic condition (alarm). + #define OCCLUSION_THRESHOLD_OFFSET 10000 ///< Threshold offset. Combined with initial reading after cartridge install, a threshold is derived above which an occlusion is detected. #define OCCLUSION_CLEAR_THRESHOLD_OFFSET 6000 ///< Threshold offset. Combined with initial reading after cartridge install, a threshold is derived below which an occlusion is cleared. #define CARTRIDGE_LOADED_THRESHOLD 5000 ///< Threshold above which a cartridge is considered loaded. @@ -89,6 +100,7 @@ #define SIZE_OF_SHORT_VEN_ROLLING_AVG ( ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) * 1 ) #define DATA_PUBLISH_COUNTER_START_COUNT 5 ///< Data publish counter start count. +#define SHIFT_14_BITS 14 ///< Shift 14 bits. /// Defined states for the pressure and occlusion monitor state machine. typedef enum PresOccl_States @@ -350,27 +362,64 @@ *************************************************************************/ static void convertInlinePressures( void ) { - U32 fpgaArtPres = getFPGAArterialPressure(); - S32 artPres = (S32)( fpgaArtPres & MASK_OFF_U32_MSB ) - 0x800000; // Subtract 2^23 from low 24 bits to get signed reading - U08 artPresAlarm = (U08)( fpgaArtPres >> SHIFT_24_BITS ); // High byte is alarm code for arterial pressure - U16 fpgaVenPres = getFPGAVenousPressure(); - U16 venPres = fpgaVenPres & 0x3FFF; // 14-bit data - U08 venPresStatus = (U08)( fpgaVenPres >> 14 ); // High 2 bits is status code for venous pressure + F32 rawArterialPres; + U08 artPresAlarm; + U08 artPresStatus; F32 venPresPSI; - F32 venTemp = getTemperatureValue( TEMPSENSOR_VENOUS_PRESSURE_SENSOR ); - U08 venReadCtr = getFPGAVenousPressureReadCounter(); + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DVT_ARTERIAL_PRESSURE_SENSOR ) ) + { + U16 fpgaArtPres = getFPGADVTArterialPressure(); + U16 artPres = fpgaArtPres & 0x3FFF; + rawArterialPres = (F32)artPres; + artPresStatus = (U08)( fpgaArtPres >> SHIFT_14_BITS ); + } + else + { + U32 fpgaArtPres = getFPGAArterialPressure(); + S32 artPres = (S32)( fpgaArtPres & MASK_OFF_U32_MSB ) - 0x800000; // Subtract 2^23 from low 24 bits to get signed reading + rawArterialPres = (F32)artPres; + artPresAlarm = (U08)( fpgaArtPres >> SHIFT_24_BITS ); // High byte is alarm code for arterial pressure + } + + U16 fpgaVenPres = getFPGAVenousPressure(); + U16 venPres = fpgaVenPres & 0x3FFF; // 14-bit data + U08 venPresStatus = (U08)( fpgaVenPres >> SHIFT_14_BITS ); // High 2 bits is status code for venous pressure + F32 venTemp = getTemperatureValue( TEMPSENSOR_VENOUS_PRESSURE_SENSOR ); + U08 venReadCtr = getFPGAVenousPressureReadCounter(); + #ifndef USE_PBO_AS_PBA + if ( ( ARTERIAL_PRESSURE_NORMAL_OP == artPresStatus ) && + ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_DVT_ARTERIAL_PRESSURE_SENSOR ) ) ) + { + U08 artReadCtr = getFPGADVTArterialPressureReadCounter(); + + // Check for stale venous pressure reading + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_ARTERIAL_PRESSURE_READ_TIMEOUT_ERROR, ( lastArterialPressureReadCtr == artReadCtr ) ) ) + { + activateAlarmNoData( ALARM_ID_HD_ARTERIAL_PRESSURE_READ_TIMEOUT_ERROR ); + } + // Record arterial pressure sensor read counter for next time around + lastArterialPressureReadCtr = artReadCtr; + + // TODO if this is the right way, change the #defines to arterial + arterialPressure.data = ( (F32)(rawArterialPres - ARTERIAL_PRESSURE_OFFSET) * + (ARTERIAL_PRESSURE_MAX_PSI - ARTERIAL_PRESSURE_MIN_PSI) / (F32)ARTERIAL_PRESSURE_SCALE ) + ARTERIAL_PRESSURE_MIN_PSI; + arterialPressure.data = arterialPressure.data * PSI_TO_MMHG; + } // Convert arterial pressure to mmHg if no fault - if ( 0 == artPresAlarm ) + else if ( 0 == artPresAlarm ) { - U08 artReadCtr = getFPGAArterialPressureReadCounter(); + U08 artReadCtr = getFPGAArterialPressureReadCounter(); U08 artErrorCtr = getFPGAArterialPressureErrorCounter(); // Check for stale arterial pressure reading + // TODO why is this alarm venous pressure sensor? + // TODO I think we should check the change of the error count not if it is greater than 0? if ( FALSE == isPersistentAlarmTriggered( ALARM_ID_HD_VENOUS_PRESSURE_READ_TIMEOUT_ERROR, ( lastArterialPressureReadCtr == artReadCtr || artErrorCtr > 0 ) ) ) { - arterialPressure.data = ARTERIAL_PRESSURE_V_PER_BIT * ( (F32)(artPres) / ( ARTERIAL_PRESSURE_SENSITIVITY * ARTERIAL_PRESSURE_V_BIAS ) ) + getF32OverrideValue( &arterialPressureOffset ); + arterialPressure.data = ARTERIAL_PRESSURE_V_PER_BIT * ( rawArterialPres / ( ARTERIAL_PRESSURE_SENSITIVITY * ARTERIAL_PRESSURE_V_BIAS ) ) + + getF32OverrideValue( &arterialPressureOffset ); } else { @@ -409,7 +458,8 @@ // 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. } } - + // TODO Why are we monitoring this sensor here? it should be in the temperatures driver + // TODO Why doesn't venous pressure have error counter? // Check venous pressure sensor temperature if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_VENOUS_PRESSURE_SENSOR_TEMP_OUT_OF_RANGE, ( venTemp > VENOUS_PRESSURE_MAX_TEMP || venTemp < VENOUS_PRESSURE_MIN_TEMP ) ) ) @@ -434,8 +484,8 @@ *************************************************************************/ static void convertOcclusionPressures( void ) { - U08 bpReadCtr = getFPGABloodPumpOcclusionReadCounter(); - U08 bpErrorCtr = getFPGABloodPumpOcclusionErrorCounter(); + U08 bpReadCtr = getFPGABloodPumpOcclusionReadCounter(); + U08 bpErrorCtr = getFPGABloodPumpOcclusionErrorCounter(); if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) { Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -125,6 +125,8 @@ #define SYRINGE_PUMP_ENCODER_STATUS_ERROR_COUNT_MASK 0x3F ///< Syringe pump encoder status error count bit-mask. // Stepper motor toggle time for zero speed (stopped) #define SYRINGE_PUMP_MICROSTEP_TOGGLE_TIME_FOR_STOP 0xFFFFFFFF ///< Syringe pump microstep toggle time setting to indicate zero speed (stopped). + +#define DATA_PUBLISH_COUNTER_START_COUNT 10 ///< Data publish counter start count. /// Control bits to run syringe pump in reverse direction static const U08 SYRINGE_PUMP_CONTROL_RUN_REVERSE = SYRINGE_PUMP_CONTROL_SLEEP_OFF | @@ -280,7 +282,7 @@ syringePumpEncoderMeasuredDirection = MOTOR_DIR_FORWARD; } - syringePumpDataPublicationTimerCounter = 0; + syringePumpDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; syringePumpSpeedCalcTimerCounter = 0; syringePumpRampTimerCtr = 0; Index: firmware/App/Controllers/Temperatures.c =================================================================== diff -u -rc1bdfa72687a75b06e3ad09cd0ed98bfd09846cc -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision c1bdfa72687a75b06e3ad09cd0ed98bfd09846cc) +++ firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -301,7 +301,7 @@ if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, isTempOutOfRange ) ) { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, lastFaultSensor, faultSensorTemp ); + //SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, lastFaultSensor, faultSensorTemp ); // DEBUG_DENALI } } Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r2acaf549519854f7e6de1511d541582267f4d1e8 -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 2acaf549519854f7e6de1511d541582267f4d1e8) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -107,6 +107,8 @@ #define VALVE_CCW_PWM_TO_CNT_CONVERSION( pwm ) ( ( -20 * pwm ) + 2500 ) ///< Valve counter clockwise PWM to count conversion #define VALVE_CCW_CNT_TO_PWM_CONVERSION( cnt ) ( ( -0.05 * cnt ) + 125 ) ///< Valve counter clockwise count to PWM conversion +#define DATA_PUBLISH_COUNTER_START_COUNT 80 ///< Data publish counter start count. + /// Exec valve self test states typedef enum valves_Self_Test_States { @@ -214,15 +216,11 @@ static const U16 VALVE_CONTROL_MODES_RESET_BITS[ NUM_OF_VALVES ] = { VDI_RESET_CONTROL_BIT_MASK, VDO_RESET_CONTROL_BIT_MASK, VBA_RESET_CONTROL_BIT_MASK, VBV_RESET_CONTROL_BIT_MASK }; ///< Valves control modes rest bits -#ifndef DISABLE_3WAY_VALVES -#ifndef DISABLE_VALVE_ALARMS static const U16 VALVE_CONTROL_STATUS_BITS[ NUM_OF_VALVES ][ NUM_OF_VALVE_CONTROL_STATUS ] = { { VDI_INIT_STATUS_BIT_MASK, VDI_ENABLE_PID_STATUS_BIT_MASK, VDI_ENABLE_BYPASS_STATUS_BIT_MASK, VDI_RESET_CONTROL_BIT_MASK }, { VDO_INIT_STATUS_BIT_MASK, VDO_ENABLE_PID_STATUS_BIT_MASK, VDO_ENABLE_BYPASS_STATUS_BIT_MASK, VDO_RESET_CONTROL_BIT_MASK }, { VBA_INIT_STATUS_BIT_MASK, VBA_ENABLE_PID_STATUS_BIT_MASK, VBA_ENABLE_BYPASS_STATUS_BIT_MASK, VBA_RESET_CONTROL_BIT_MASK }, { VBV_INIT_STATUS_BIT_MASK, VBV_ENABLE_PID_STATUS_BIT_MASK, VBV_ENABLE_BYPASS_STATUS_BIT_MASK, VBV_RESET_CONTROL_BIT_MASK } }; ///< Valves control status bits -#endif -#endif static U16 valvesControlSetBits = 0x0000; ///< Valves control set bit static OPN_CLS_STATE_T valveAirTrapStatus; ///< Air trap valve status (open/close) @@ -282,11 +280,12 @@ // Initialize some of the variables for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { - valvesStatus[ valve ].execState = VALVE_STATE_WAIT_FOR_POST; - valvesStatus[ valve ].current.data = 0.0; - valvesStatus[ valve ].current.ovData = 0.0; + valvesStatus[ valve ].execState = VALVE_STATE_WAIT_FOR_POST; + valvesStatus[ valve ].current.data = 0.0; + valvesStatus[ valve ].current.ovData = 0.0; valvesStatus[ valve ].current.ovInitData = 0.0; - valvesStatus[ valve ].current.override = 0; + valvesStatus[ valve ].current.override = 0; + valvesStatus[ valve ].dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; } // Close air trap valve @@ -739,9 +738,7 @@ valvesStatus[ valve ].hasValveBeenHomed = FALSE; valvesStatus[ valve ].hasHomingFailed = TRUE; state = VALVE_STATE_HOMING_NOT_STARTED; -#ifndef DISABLE_VALVE_ALARMS SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_VALVE_HOMING_FAILED, (U32)valve ); -#endif } else { @@ -778,16 +775,6 @@ { VALVE_STATE_T state = VALVE_STATE_IDLE; -#ifdef TST_3WAY_VALVES_ALWAYS_OPEN - static BOOL valvesOpenedForSarina[NUM_OF_VALVES] = { FALSE, FALSE, FALSE, FALSE }; - - if ( FALSE == valvesOpenedForSarina[ valve ] ) - { - valvesOpenedForSarina[ valve ] = TRUE; - setValvePosition( valve, VALVE_POSITION_B_OPEN ); - } -#endif - if ( TRUE == valvesStatus[ valve ].hasHomingBeenRequested ) { state = VALVE_STATE_HOMING_NOT_STARTED; @@ -866,9 +853,8 @@ //valvesStatus[ valve ].hasTransitionBeenRequested = FALSE; TODO remove // Go back to Idle state state = VALVE_STATE_IDLE; -#ifndef DISABLE_VALVE_ALARMS SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_VALVE_TRANSITION_TIMEOUT, (U32)valve ); -#endif + // If the valve transition timeout is active and the valve's commanded positions is position C, activate safety shutdown if ( ( TRUE == isAlarmActive( ALARM_ID_HD_VALVE_TRANSITION_TIMEOUT ) ) && ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) ) { @@ -954,15 +940,12 @@ *************************************************************************/ static void execMonitorValves( void ) { -#ifndef DISABLE_3WAY_VALVES // Check if the valves are still enabled areValvesFunctional(); -#endif // Get the current position of the valves in counts and store them getAndMonitorValvesCurrentFPGAPosition(); -#ifndef DISABLE_3WAY_VALVES // Get the current in ADC and convert them to amps // Check whether any of the valves are over current convertAndMonitorValvesCurrent(); @@ -972,7 +955,6 @@ #ifdef DEBUG_ENABLED getValvesCurrentPWM(); #endif -#endif } /*********************************************************************//** @@ -987,8 +969,6 @@ static BOOL areValvesFunctional( void ) { BOOL result = TRUE; -#ifndef DISABLE_3WAY_VALVES -#ifndef DISABLE_VALVE_ALARMS VALVE_T valve; VALVE_MODE_T mode; @@ -1036,8 +1016,6 @@ result = FALSE; } } -#endif -#endif return result; } @@ -1127,9 +1105,7 @@ // Check if the current is over the threshold for the defined amount of time if ( valvesStatus[ valve ].overCurrentCounter > MAX_OVER_CURRENT_TIME_INTERVAL_COUNTER ) { -#ifndef DISABLE_VALVE_ALARMS SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_VALVE_CURRENT_OUT_OF_RANGE, (F32)valve, current ); -#endif } // If the current is below the threshold again and the counter for the time is greater than else if ( ( current < VALVES_CURRENT_THRESHOLD_AMPS ) && ( valvesStatus[ valve ].overCurrentCounter > 0 ) ) @@ -1163,7 +1139,6 @@ valvesStatus[ VBA ].currentPositionInCounts.data = (S32)getFPGAValveBloodArterialPosition(); valvesStatus[ VBV ].currentPositionInCounts.data = (S32)getFPGAValveBloodVenousPosition(); -#ifndef DISABLE_3WAY_VALVES // Check the position of each valve for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { @@ -1192,9 +1167,7 @@ if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) { -#ifndef DISABLE_VALVE_ALARMS SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); -#endif } else if ( abs( currentPosition - commandedPosition ) < MAX_DEVIATION_FROM_TARGET_IN_COUNTS && valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) @@ -1203,7 +1176,6 @@ } } } -#endif } /*********************************************************************//** Index: firmware/App/HDCommon.h =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -32,47 +32,48 @@ // TODO - remove build switches before release #ifndef _RELEASE_ #ifndef _VECTORCAST_ +// Build switches. NOTE: These build switches will remain as #define // #define USING_DEBUGGER 1 // Want to be able to use the debugger and have break points // #define BOARD_WITH_NO_HARDWARE 1 // Target is a PCB w/ no hardware // #define RUN_WITHOUT_DG 1 // Run HD w/o DG // #define SIMULATE_UI 1 // Build w/o requirement that UI be there // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing - // TODO convert the new configuration way -// #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 // TODO sw config implemented -// #define RUN_BP_OPEN_LOOP 1 // Run blood pump in open loop mode -// #define RUN_DPI_OPEN_LOOP 1 // Run dialysate inlet pump in open loop mode -// #define PBA_ESTIMATION 1 // Estimate arterial pressure rather than look at PBA sensor - #define USE_PBO_AS_PBA 1 // PBo readings used for PBA, PBo replaced with fixed pressure (100 mmHg) - -// #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks - #define DISABLE_DIALYSATE_TEMP_CHECK 1 // Disable dialysate temperature check -// #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position - #define SKIP_CAL_CHECK 1 -// #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) + #define DISABLE_BATT_COMM 1 // Disable battery communication // #define READ_FPGA_ASYNC_DATA 1 // Test build reads non-priority register page every other time -// #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button - #define ALARMS_DEBUG 1 // Triggered alarms sent to debug UART - #define ALARM_VOLUME_DEFAULT_LOW 1 // Set default alarm volume to lowest - #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 SKIP_CARTRIDGE_REMOVAL 1 // Skip cartridge removal check // #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 NO_PUMP_FLOW_LIMITS 1 // Allow any commanded flow rate for peristaltic pumps - #define DISABLE_BUBBLE_ALARMS 1 // Disable bubble alarms - #define DISABLE_UI_POST_TEST 1 // Disable the UI POST -// #define DISABLE_UI_COMM_TO_ALARM 1 // Disable UI comm timeouts - #define DISABLE_WD_AND_SFTY_POST_TESTS 1 // Disable watchdog and safety shutdown POST tests - #define DISABLE_ILLEGAL_AIR_TRAP_ALARM 1 // Disable illegal state for air trap alarm - #define SKIP_RESERVOIR_ALARMS 1 // Skip reservoir management alarms +// #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button + #define DISABLE_WD_AND_SFTY_POST_TESTS 1 // Disable watchdog and safety shutdown POST tests + #define DISABLE_UI_POST_TEST 1 // Disable the UI POSTh + // TODO convert the new configuration way +// #define DISABLE_ACCELS 1 // Disable accelerometer POST and monitoring // Implement +// #define RUN_BP_OPEN_LOOP 1 // Run blood pump in open loop mode // Implement +// #define RUN_DPI_OPEN_LOOP 1 // Run dialysate inlet pump in open loop mode // Implement +// #define PBA_ESTIMATION 1 // Estimate arterial pressure rather than look at PBA sensor // Part of DVT build switch +// #define USE_PBO_AS_PBA 1 // PBo readings used for PBA, PBo replaced with fixed pressure (100 mmHg) // Not needed +// #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks // Implement // TODO implemented CHECK THE LAST ONE +// #define DISABLE_DIALYSATE_TEMP_CHECK 1 // Disable dialysate temperature check // Implement // TODO implemented + #define SKIP_CAL_CHECK 1 // Implement +// #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // Not needed + +// #define ALARM_VOLUME_DEFAULT_LOW 1 // Set default alarm volume to lowest // Implement // TODO implemented + +// #define SKIP_AIR_BUBBLE_CHECK 1 // Skip air bubble detector self-test. // Implement // TODO implemented + #define DISABLE_OCCLUSION_SELF_TEST 1 // Skip occlusion sensor self-test. // Implement +// #define SKIP_CARTRIDGE_REMOVAL 1 // Skip cartridge removal check // Implement + + #define DISABLE_VOLTAGE_MONITOR 1 // Disable voltage monitoring/alarms // Implement + #define ALLOW_1_MIN_TREATMENT_DURATION 1 // Allow user to change treatment duration to as low as 1 minute // Implement +// #define NO_PUMP_FLOW_LIMITS 1 // Allow any commanded flow rate for peristaltic pumps // Implement +// #define DISABLE_BUBBLE_ALARMS 1 // Disable bubble alarms // Implement // TODO implemented + +// #define DISABLE_UI_COMM_TO_ALARM 1 // Disable UI comm timeouts // Implement + +// #define DISABLE_ILLEGAL_AIR_TRAP_ALARM 1 // Disable illegal state for air trap alarm // Implement // TODO implemented + #define SKIP_RESERVOIR_ALARMS 1 // Skip reservoir management alarms // Implement + + #include #include #endif Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -1050,7 +1050,10 @@ if ( uFMeasRate > MAX_UF_RATE_ML_PER_HOUR ) { #ifndef DISABLE_UF_ALARMS - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_UF_RATE_TOO_HIGH_ERROR, uFMeasRate ); + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) + { + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_UF_RATE_TOO_HIGH_ERROR, uFMeasRate ); + } #endif } // Increment timer and see if time to start another 1 hour check period @@ -1065,7 +1068,10 @@ if ( ( fabs( refUFVolume - measUFVolume ) ) >= (F32)MAX_UF_ACCURACY_ERROR_ML ) { #ifndef DISABLE_UF_ALARMS - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_UF_VOLUME_ACCURACY_ERROR, refUFVolume, measUFVolume ); + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_UF_VOLUME_ACCURACY_ERROR, refUFVolume, measUFVolume ); + } #endif } } @@ -1086,13 +1092,17 @@ LOAD_CELL_ID_T loadCell = ( activeRes == DG_RESERVOIR_1 ? LOAD_CELL_RESERVOIR_1_PRIMARY : LOAD_CELL_RESERVOIR_2_PRIMARY ); F32 latestResVolume = getLoadCellWeight( loadCell ); #ifndef DISABLE_UF_ALARMS - F32 deltaVolume = latestResVolume - resLastVolume[ activeRes ]; - - // ensure volume change is not too excessive - indication that load cell was impacted by some kind of shock - if ( fabs(deltaVolume) > MAX_ACTIVE_LOAD_CELL_CHANGE_G ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) { - ALARM_ID_T deltaAlarm = ( getDGActiveReservoir() == DG_RESERVOIR_1 ? ALARM_ID_HD_LOAD_CELL_ACCELERATION_RES_1_ALARM : ALARM_ID_HD_LOAD_CELL_ACCELERATION_RES_2_ALARM ); - SET_ALARM_WITH_1_F32_DATA( deltaAlarm, deltaVolume ); + F32 deltaVolume = latestResVolume - resLastVolume[ activeRes ]; + + // ensure volume change is not too excessive - indication that load cell was impacted by some kind of shock + if ( fabs(deltaVolume) > MAX_ACTIVE_LOAD_CELL_CHANGE_G ) + { + ALARM_ID_T deltaAlarm = ( getDGActiveReservoir() == DG_RESERVOIR_1 ? ALARM_ID_HD_LOAD_CELL_ACCELERATION_RES_1_ALARM : + ALARM_ID_HD_LOAD_CELL_ACCELERATION_RES_2_ALARM ); + SET_ALARM_WITH_1_F32_DATA( deltaAlarm, deltaVolume ); + } } else #endif Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -1178,7 +1178,8 @@ BUBBLE_STATUS_T const ADVBubbleStatus = getBubbleStatus( ADV ); #ifndef SKIP_AIR_BUBBLE_CHECK - if ( ( BUBBLE_NOT_DETECTED == ADABubbleStatus ) && ( BUBBLE_NOT_DETECTED == ADVBubbleStatus ) ) + if ( ( ( BUBBLE_NOT_DETECTED == ADABubbleStatus ) && ( BUBBLE_NOT_DETECTED == ADVBubbleStatus ) ) || + ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SELF_TESTS_AIR_BUBBLE_CHECK ) != SW_CONFIG_ENABLE_VALUE ) ) #endif { if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_BLOOD_LEAK_SELF_TEST ) != SW_CONFIG_ENABLE_VALUE ) Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -115,12 +115,12 @@ static OVERRIDE_U32_T alarmStatusPublishInterval = { ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, 0 }; /// Interval (in task intervals) at which to publish alarm information to CAN bus. static OVERRIDE_U32_T alarmInfoPublishInterval = { ALARM_INFO_PUB_INTERVAL, ALARM_INFO_PUB_INTERVAL, ALARM_INFO_PUB_INTERVAL, 0 }; -#ifndef ALARM_VOLUME_DEFAULT_LOW +//#ifndef ALARM_VOLUME_DEFAULT_LOW // DEBUG_DENALI /// Set alarm audio volume attenuation level (0..4 - lower level = higher gain). -static OVERRIDE_U32_T alarmAudioVolumeLevel = { MIN_ALARM_VOLUME_ATTENUATION, MIN_ALARM_VOLUME_ATTENUATION, MIN_ALARM_VOLUME_ATTENUATION, 0 }; -#else +//static OVERRIDE_U32_T alarmAudioVolumeLevel = { MIN_ALARM_VOLUME_ATTENUATION, MIN_ALARM_VOLUME_ATTENUATION, MIN_ALARM_VOLUME_ATTENUATION, 0 }; +//#else static OVERRIDE_U32_T alarmAudioVolumeLevel = { MAX_ALARM_VOLUME_ATTENUATION, MAX_ALARM_VOLUME_ATTENUATION, MAX_ALARM_VOLUME_ATTENUATION, 0 }; -#endif +//#endif /// Alarm audio current (high gain) measured at ADC. static OVERRIDE_F32_T alarmPrimaryAudioCurrentHG = { 0.0, 0.0, 0.0, 0 }; /// Alarm audio current (low gain) measured at ADC. @@ -222,7 +222,7 @@ * @return none *************************************************************************/ void execAlarmMgmt( void ) -{ +{ monitorAlarms(); handleAlarmEscalations(); updateAlarmsState(); @@ -1204,6 +1204,12 @@ { U32 result = alarmAudioVolumeLevel.data; + // Check the software configurations + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_ALARM_VOLUME_DEFAULT_LOW ) ) + { + result = MIN_ALARM_VOLUME_ATTENUATION; + } + if ( OVERRIDE_KEY == alarmAudioVolumeLevel.override ) { result = alarmAudioVolumeLevel.ovData; Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r61716bc97ecca8af1ec560333844a8cf602eccb0 -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 61716bc97ecca8af1ec560333844a8cf602eccb0) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -234,6 +234,10 @@ U16 bloodStCount; ///< Reg 434. Blood leak St Count. U16 bloodLEDIntensity; ///< Reg 436. Blood leak LED intensity. U16 bloodRdCounter; ///< Reg 438. Blood leak register counter. + U16 arterialPressure; ///< Reg 440. Arterial pressure sensor. + U16 arterialPressureTemperature; ///< Reg 442. Arterial pressure sensor temperature. + U08 arterialPressureReadCount; ///< Reg 444. Arterial pressure sensor read count. + U08 arterialPressureErrorCount; ///< Reg 445. Arterial pressure sensor error count. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -1552,6 +1556,57 @@ /*********************************************************************//** * @brief + * The getFPGADVTArterialPressure function gets the latest arterial pressure reading. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last arterial pressure reading + *************************************************************************/ +U16 getFPGADVTArterialPressure( void ) +{ + return fpgaSensorReadings.arterialPressure; +} + +/*********************************************************************//** + * @brief + * The getFPGADVTArterialTemperature function gets the latest arterial pressure + * sensor temperature reading. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last arterial pressure sensor temperature reading + *************************************************************************/ +U16 getFPGADVTArterialTemperature( void ) +{ + return fpgaSensorReadings.arterialPressureTemperature; +} + +/*********************************************************************//** + * @brief + * The getFPGADVTArterialPressureReadCounter function gets the latest arterial + * pressure sensor read counter. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last arterial pressure sensor read counter + *************************************************************************/ +U08 getFPGADVTArterialPressureReadCounter( void ) +{ + return fpgaSensorReadings.arterialPressureReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGATDVTArterialPressureErrorCounter function gets the latest arterial + * pressure sensor error counter. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last arterial pressure sensor error counter + *************************************************************************/ +U08 getFPGATDVTArterialPressureErrorCounter( void ) +{ + return fpgaSensorReadings.arterialPressureErrorCount; +} + +/*********************************************************************//** + * @brief * The getFPGAVenousPressure function gets the latest venous pressure reading. * The high 2 bits are status bits: 00=ok, 01=cmd mode, 10=stale data, 11=diag * The low 14 bits are data. Zero is at 1638. Values above are positive, Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r61716bc97ecca8af1ec560333844a8cf602eccb0 -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 61716bc97ecca8af1ec560333844a8cf602eccb0) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -79,6 +79,12 @@ U32 getFPGAArterialPressure( void ); U08 getFPGAArterialPressureReadCounter( void ); U08 getFPGAArterialPressureErrorCounter( void ); + +U16 getFPGADVTArterialPressure( void ); +U16 getFPGADVTArterialTemperature( void ); +U08 getFPGADVTArterialPressureReadCounter( void ); +U08 getFPGATDVTArterialPressureErrorCounter( void ); + U16 getFPGAVenousPressure( void ); U16 getFPGAVenousPressureTemperature( void ); U08 getFPGAVenousPressureReadCounter( void ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rdc951a5c309a10b4087162eac591ea4ebb66f329 -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision dc951a5c309a10b4087162eac591ea4ebb66f329) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -781,9 +781,7 @@ { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_BAD_MSG_CRC ) ) { -#ifndef DISABLE_CRC_ERROR SET_ALARM_WITH_1_U32_DATA( ALARM_ID_COMM_TOO_MANY_BAD_CRCS, (U32)ALARM_SOURCE_HD ); -#endif } } Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rd33ae635eb38ae8f2647f68304be74e8e4f78cfd -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d33ae635eb38ae8f2647f68304be74e8e4f78cfd) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -152,8 +152,7 @@ { data[ msgSize++ ] = 0; } - - #ifndef DISABLE_ACK_ERRORS + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ACK_ERRORS ) != SW_CONFIG_ENABLE_VALUE ) { // If ACK required, add to pending ACK list @@ -166,7 +165,6 @@ } } } - #endif if ( FALSE == error ) { Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r667feab319b14681a0330a715da7a1ba930b518d -r29a2c3c7d7618489c0ada9f98e1d30226b455392 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 667feab319b14681a0330a715da7a1ba930b518d) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 29a2c3c7d7618489c0ada9f98e1d30226b455392) @@ -106,12 +106,10 @@ // Monitor accelerometer execAccel(); #endif -#ifndef DISABLE_3WAY_VALVES // Exec and monitor valves execValves(); #endif #endif -#endif // 2nd pass for FPGA execFPGAOut(); }