Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -recba518e47db27ce66d40db425f765ed676be173 -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision ecba518e47db27ce66d40db425f765ed676be173) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -45,13 +45,11 @@ #define BAL_CHAMBER_FILL_PRES_DROP_MS ( 200 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber filling started and corrosponding valves opened. #define BAL_CHAMBER_FILL_COMPLETE_MS ( 300 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber fill completed and pressure is within range #define SPENT_FILL_COMPLETE_PRES 25.0F ///< Spent fill complete pressure (PSI) for Diener 2000 pump. -#define SPENT_FILL_COMPLETE_PRES_QD_MID_PSIG 15.0F ///< Spent fill complete pressure (PSI) when Diener 1000 and 200 < Qd <= 400. +#define SPENT_FILL_COMPLETE_PRES_QD_MID_PSIG 10.0F ///< Spent fill complete pressure (PSI) when Diener 1000 and 200 < Qd <= 400. #define SPENT_FILL_COMPLETE_PRES_QD_HIGH_PSIG 20.0F ///< Spent fill complete pressure (PSI) when Diener 1000 and Qd > 400. #define SPENT_FILL_COMPLETE_QD_SLOPE_MAX_MLPM 300.0F ///< For Qd <= 300 mL/min, spent fill completion uses pressure-rise slope detection. -#define SPENT_FILL_COMPLETE_QD_TWO_HIT_MAX_MLPM 150.0F ///< For Qd <= 150 mL/min, require two rise detections; above this and <=300, one rise detection is enough. #define SPENT_FILL_COMPLETE_DP_RISE_PSIG 0.5F ///< Minimum 100 ms spent pressure rise (current minus n-2) to count as a rise hit at low Qd. #define SPENT_FILL_SLOPE_SPENT_PRESSURE_HIGH_PSIG 2.0F ///< Above this absolute spent pressure, only one rise hit is required. -#define SPENT_FILL_SLOPE_SPENT_PRESSURE_LOW_PSIG 0.5F ///< Below this absolute spent pressure, use Qd-based required rise hit count. #define SPENT_FILL_SLOPE_MAX_RISE_HITS 2 ///< Rise hits required when Qd <= 150 in the low spent-pressure band. #define SPENT_FILL_DETECT_COUNT_TOL_PCT 1.0F ///< Allowed detection timing tolerance as a fraction of expected BC switching count. #define QD_THRESHOLD_HIGH_MLPM 400.0F ///< Qd threshold (mL/min) below which mid pressure limit applies. @@ -60,7 +58,7 @@ #define D48_SPEED_RANGE_LIMIT 0.25F ///< D48 speed adjustment range check limit ( D48 speed can vary +/-25% of initial calculated speed) #define BICARB_CHAMBER_PERIODIC_FILL_TIME ( 1 * SEC_PER_MIN * \ ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ) ///< Periodic bicarb chamber fill request 60 sec x 20 = 1200 -#define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 2.5F ///< Balancing Chamber fill timeout factor (250% of observed fill count) +#define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 3.0F ///< Balancing Chamber fill timeout factor (300% of observed fill count) /// Payload record structure for balancing chamber switch only request typedef struct @@ -266,7 +264,7 @@ //Update last td dialysate flow rate lastTdDialysateFlowrate = tdDialysateFlowrate; - // Update fill timeout count based on the switching period (e.g. 250% of period) + // Update fill timeout count based on the switching period (e.g. 300% of period) balChamberFillTimeoutCount = (U32)( (F32)balChamberSwitchingPeriod * BAL_CHAMBER_FILL_TIMEOUT_FACTOR ); //Reset the BC switching flag for new Qd. @@ -1148,6 +1146,13 @@ state = BAL_CHAMBER_STATE1_FILL_START; } } + else + { // For Balancing Chamber Switch Only command, change state as per the switching period + if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) + { + state = BAL_CHAMBER_STATE1_FILL_START; + } + } // Clear the switching only on request flag. balanceChamberSwitchingOnlyOnRequested = FALSE; @@ -1270,10 +1275,6 @@ { requiredRiseCount = 1U; } - else if ( riseDeltaPsi < SPENT_FILL_SLOPE_SPENT_PRESSURE_LOW_PSIG ) - { - requiredRiseCount = ( qdMlpm <= SPENT_FILL_COMPLETE_QD_TWO_HIT_MAX_MLPM ) ? SPENT_FILL_SLOPE_MAX_RISE_HITS : 1U; - } else { requiredRiseCount = 2U; @@ -1400,8 +1401,11 @@ } } - //Update spent fill is complete - isSpentFillComplete = TRUE; + //Update spent fill is complete + if ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) + { + isSpentFillComplete = TRUE; + } } } } Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17 -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -852,6 +852,8 @@ concentratePumps[ pumpId ].currentPumpSpeed = 0.0F; // set target rate to zero pumpTargetSpeed[ pumpId ].data = 0.0F; pumpTargetRevCnt[ pumpId ].data = 0; + measuredPumpSpeed[ pumpId ].data = 0.0F; + concentratePumps[ pumpId ].pulseWidthUS = 0.0F; isDosingCompleted [ pumpId ] = TRUE; // Disable the motor when stopping, to take next revolution count @@ -1117,16 +1119,26 @@ pulseWidthInMicroSeconds = pulseWidthCount * CONCENTRATE_PUMP_HALL_SENSE_PERIOD_RESOLUTION; concentratePumps[ pumpId ].pulseWidthUS = pulseWidthInMicroSeconds; - isPumpPulseWidthOut = ( pulseWidthInMicroSeconds <= (F32)CONCENTRATE_PUMP_MIN_ALLOWED_HALL_SENSOR_COUNT ? TRUE : FALSE ); + isPumpPulseWidthOut = FALSE; // Determine measured speed for the pump - if ( CONCENTRATE_PUMP_ZERO_FLOW_RATE == pulseWidthCount ) + if ( ( concentratePumps[ pumpId ].currentPumpSpeed <= NEARLY_ZERO ) || + ( CONCENTRATE_PUMP_ZERO_FLOW_RATE == pulseWidthCount ) ) { measuredPumpSpeed[ pumpId ].data = 0.0F; } - else if ( FALSE == isPumpPulseWidthOut ) + else { - measuredPumpSpeed[ pumpId ].data = ( US_PER_SECOND / pulseWidthInMicroSeconds ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE_DIENER * SEC_PER_MIN; + isPumpPulseWidthOut = ( pulseWidthInMicroSeconds <= (F32)CONCENTRATE_PUMP_MIN_ALLOWED_HALL_SENSOR_COUNT ? TRUE : FALSE ); + + if ( FALSE == isPumpPulseWidthOut ) + { + measuredPumpSpeed[ pumpId ].data = ( US_PER_SECOND / pulseWidthInMicroSeconds ) * CONCENTRATE_PUMP_VOLUME_PER_PULSE_DIENER * SEC_PER_MIN; + } + else + { + measuredPumpSpeed[ pumpId ].data = 0.0F; + } } // If pulse width is out of range capture pump out of range, pumpId and pulse width Index: firmware/App/DDCommon.h =================================================================== diff -u -r83801fb34ea084512961215be50b3558794ec88b -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 83801fb34ea084512961215be50b3558794ec88b) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -53,17 +53,18 @@ //Uncomment below to disable revised heater model #define __REVISED_HEATER_MODEL__ 1 + // comment below to disable bicarb multi level sensor for time based chamber F fill #define CONDUCTIVE_LEVEL_SENSOR_ENABLED 1 //Uncomment below to enable d30 heater alarm(as all units are not equipped with d30 temp sensor) //#define ENABLE_ALARM_3 -//Define to enable the DD too-many-bad-message-CRCs alarm. -//#define __BAD_MSG_CRC_ALARM_ENABLED__ 1 +//Comment below to disable the DD too-many-bad-message-CRCs alarm. +#define __BAD_MSG_CRC_ALARM_ENABLED__ 1 -//Uncomment below to enable the conductivity sensor alarms -//#define ENABLE_ALARM_4 +//Comment below to disable the conductivity sensor alarms +#define ENABLE_ALARM_4 #include Index: firmware/App/Drivers/ConductivitySensors.c =================================================================== diff -u -r8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17 -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Drivers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17) +++ firmware/App/Drivers/ConductivitySensors.c (.../ConductivitySensors.c) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -554,8 +554,8 @@ { if ( ++conductivitySensorStatus[ sensorId ].interalCondErrorCount > MAX_ALLOWED_UNCHANGED_CONDUCTIVITY_READS ) { - //TODO: restore once conductivity sensor are calibrates and working -#ifdef ENABLE_ALARM_4 + //TODO: restore once conductivity sensor are calibrated and working +#ifndef ENABLE_ALARM_4 SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, sensorId ) #endif } @@ -570,8 +570,8 @@ { if ( ++conductivitySensorStatus[ sensorId ].interalTempErrorCount > MAX_ALLOWED_UNCHANGED_CONDUCTIVITY_READS ) { - //TODO: restore once conductivity sensor are calibrates and working -#ifdef ENABLE_ALARM_4 + //TODO: restore once conductivity sensor are calibrated and working +#ifndef ENABLE_ALARM_4 SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, sensorId ) #endif } @@ -581,8 +581,8 @@ { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CONDUCTIVITY_SENSOR_ERROR ) ) { - //TODO: restore once conductivity sensor are calibrates and working -#ifdef ENABLE_ALARM_4 + //TODO: restore once conductivity sensor are calibrated and working +#ifndef ENABLE_ALARM_4 SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, sensorId ) #endif } @@ -701,8 +701,8 @@ // Alarm if any data is out of range. if ( FALSE == result ) { - //TODO: restore once conductivity sensor are calibrates and working -#ifdef ENABLE_ALARM_4 + //TODO: restore once conductivity sensor are calibrated and working +#ifndef ENABLE_ALARM_4 SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, sensorId, ( U32 )idx ) #endif } Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -recba518e47db27ce66d40db425f765ed676be173 -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision ecba518e47db27ce66d40db425f765ed676be173) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -669,11 +669,6 @@ F32 calculatedSpeed; U32 rpm; - if ( 0U == getBalChamberSwitchingPeriod() ) - { - dialFlowrate = getTDDialysateFlowrate(); - } - if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DIENER_2000_PUMP ) ) { slope = PUMP_SPEED_SLOPE_FACTOR_DIENER_2000; Index: firmware/App/Monitors/Level.c =================================================================== diff -u -r8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17 -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Monitors/Level.c (.../Level.c) (revision 8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -545,10 +545,10 @@ { DD_LEVEL_DATA_T data; - data.d6Level = (U32)getFloaterStatus( D6_LEVL ); data.d46Level = (U32)getLevelStatus( D46_LEVL ); data.d63Level = (U32)getLevelStatus( D63_LEVL ); data.d98Level = (U32)getLevelStatus( D98_LEVL ); + data.d6Level = (U32)getFloaterStatus( D6_LEVL ); data.bicarbLevel = (U32)getBicarbChamberLevelStatus(); levelsDataPublicationCounter = 0; Index: firmware/App/Monitors/Level.h =================================================================== diff -u -r2d295ca85f19e95da42476a57ca6b4496baf980a -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Monitors/Level.h (.../Level.h) (revision 2d295ca85f19e95da42476a57ca6b4496baf980a) +++ firmware/App/Monitors/Level.h (.../Level.h) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -69,10 +69,10 @@ /// DD floater and level sensor data publish structure typedef struct { - U32 d6Level; ///< Floater level U32 d46Level; ///< Spent dialysate level U32 d63Level; ///< Bicarb lower level U32 d98Level; ///< Bicarb upper level + U32 d6Level; ///< Floater level U32 bicarbLevel; ///< Bicarb chamber level combination ( D63 + D98 ) } DD_LEVEL_DATA_T; Index: firmware/App/Services/SystemCommDD.c =================================================================== diff -u -r8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17 -rbdf2c733a764466fcc4a0ff4938f5c97456bdb77 --- firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 8348015aa77e1ee2c4c20e9f8e2c45b59bcf3f17) +++ firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision bdf2c733a764466fcc4a0ff4938f5c97456bdb77) @@ -92,7 +92,7 @@ initSystemComm(); //TODO: Restore this as this was system specific -#ifdef __BAD_MSG_CRC_ALARM_ENABLED__ +#ifndef __BAD_MSG_CRC_ALARM_ENABLED__ // initialize bad message CRC time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_BAD_MSG_CRC, MAX_COMM_CRC_FAILURES, MAX_COMM_CRC_FAILURE_WINDOW_MS ); #endif