Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r927c47388ab6bd716b857f76e2026c116dd52e69 -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) @@ -382,7 +382,6 @@ bloodPumpSetSpeedRPM = 0; isBloodPumpOn = FALSE; bpControlTimerCounter = 0; - setPeristalticPumpSetSpeed( bloodPumpSetSpeedRPM ); setPeristalticPumpHardStop(); resetPIController( PI_CONTROLLER_ID_BLOOD_FLOW, 0.0F, 0.0F ); } @@ -469,7 +468,7 @@ { bloodPumpRotorCounter.data = 0; - if ( TRUE == getTestConfigStatus( TEST_CONFIG_USE_WORN_CARTRIDGE ) ) + //if ( TRUE == getTestConfigStatus( TEST_CONFIG_USE_WORN_CARTRIDGE ) ) { bloodPumpRotorCounter.data = BP_MAX_ROTOR_COUNT_FOR_WEAR; } Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r927c47388ab6bd716b857f76e2026c116dd52e69 -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 927c47388ab6bd716b857f76e2026c116dd52e69) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) @@ -148,6 +148,16 @@ valvesDataPublishInterval.ovData = VALVES_DATA_PUB_INTERVAL; valvesDataPublishInterval.ovInitData = 0; valvesDataPublishInterval.override = OVERRIDE_RESET; + +#ifdef ASN_DEMO + currentValveStates[ H1_VALV ].positionsABC[ VALVE_POSITION_C_CLOSE ] = ROTARY_VALVE_MICROSTEP_FRACTION; + currentValveStates[ H1_VALV ].positionsABC[ VALVE_POSITION_B_OPEN ] = 1728; + currentValveStates[ H1_VALV ].positionsABC[ VALVE_POSITION_A_INSERT_EJECT ] = 880; + + currentValveStates[ H19_VALV ].positionsABC[ VALVE_POSITION_C_CLOSE ] = ROTARY_VALVE_MICROSTEP_FRACTION; + currentValveStates[ H19_VALV ].positionsABC[ VALVE_POSITION_B_OPEN ] = 1728; + currentValveStates[ H19_VALV ].positionsABC[ VALVE_POSITION_A_INSERT_EJECT ] = 880; +#endif } /*********************************************************************//** @@ -165,7 +175,6 @@ { BOOL result = FALSE; -#ifndef TEST_NO_PINCH_VALVES if ( valve < NUM_OF_VALVES ) { VALVE_STATE_T currState = currentValveStates[ valve ].controlState; @@ -189,7 +198,6 @@ { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_TD_VALVES_INVALID_VALVE8, (U32)valve ) } -#endif return result; } @@ -208,7 +216,6 @@ { BOOL result = FALSE; -#ifndef TEST_NO_PINCH_VALVES if ( ( valve < NUM_OF_VALVES ) && ( position < NUM_OF_VALVE_POSITIONS ) ) { currentValveStates[ valve ].pendingCommandedPosition = position; @@ -220,7 +227,6 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_TD_VALVES_INVALID_PARAM, ( (U32)valve << SHIFT_16_BITS_FOR_WORD_SHIFT ) | (U32)position ) } -#endif return result; } @@ -478,6 +484,10 @@ currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] = ROTARY_VALVE_MICROSTEP_FRACTION; currentValveStates[ valve ].positionsABC[ VALVE_POSITION_D_VENOUS ] = POS_D_VENOUS_OFFSET_FROM_ZERO_CNT; nextState = VALVE_STATE_HOMING_NOT_STARTED; + +#ifdef ASN_DEMO + nextState = VALVE_STATE_IDLE; +#endif } return nextState; @@ -501,7 +511,7 @@ switch ( currentValveStates[ valve ].valveHomingStatus ) { case VALVE_HOMING_INIT: - currentValveStates[ valve ].proposedEnergizedPos = ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS; + currentValveStates[ valve ].proposedEnergizedPos = ROTARY_VALVE_INIT_FULL_SWING_COUNTS; break; case VALVE_HOMING_FORWARD: @@ -517,13 +527,22 @@ break; } - // Command valve to move to energized edge (end of travel) - currentValveStates[ valve ].valveOpsStartTime = 0; - currentValveStates[ valve ].hasValveBeenHomed = FALSE; - currentValveStates[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; - nextState = VALVE_STATE_HOMING_FIND_ENERGIZED_EDGE; - - setValveCmdChangePosition( valve, (U16)currentValveStates[ valve ].proposedEnergizedPos, MOTOR_DIR_FORWARD ); + if ( ( currentValveStates[ valve ].proposedEnergizedPos <= ROTARY_VALVE_ENERGIZED_EDGE_MIN_COUNTS ) || + ( currentValveStates[ valve ].proposedEnergizedPos >= ROTARY_VALVE_ENERGIZED_EDGE_MAX_COUNTS ) ) + { + currentValveStates[ valve ].hasHomingFailed = TRUE; + currentValveStates[ valve ].hasHomingBeenRequested = FALSE; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_VALVE_HOMING_FAILED, (U32)valve, (U32)currentValveStates[ valve ].proposedEnergizedPos ) + } + else + { + // Command valve to move to energized edge (end of travel) + currentValveStates[ valve ].valveOpsStartTime = 0; + currentValveStates[ valve ].hasValveBeenHomed = FALSE; + currentValveStates[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; + nextState = VALVE_STATE_HOMING_FIND_ENERGIZED_EDGE; + setValveCmdChangePosition( valve, (U16)currentValveStates[ valve ].proposedEnergizedPos, MOTOR_DIR_FORWARD ); + } } return nextState; Index: firmware/App/Drivers/RotaryValve.h =================================================================== diff -u -ra811cae0392f1d0f976650ff167945e614b3b854 -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 --- firmware/App/Drivers/RotaryValve.h (.../RotaryValve.h) (revision a811cae0392f1d0f976650ff167945e614b3b854) +++ firmware/App/Drivers/RotaryValve.h (.../RotaryValve.h) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) @@ -35,15 +35,17 @@ #define ROTARY_VALVE_MICROSTEP_FRACTION 8 ///< Rotary valve motors configured for 1/8 step microstepping. #define ROTARY_VALVE_GEAR_RATIO 3.7F ///< Rotary valve motor gear ratio is 3.7:1. -#define ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS 1760 ///< Rotary valve swing arm travel range is appx. micro steps. +#define ROTARY_VALVE_INIT_FULL_SWING_COUNTS 1760 ///< Rotary valve swing arm travel range is appx. micro steps. +#define ROTARY_VALVE_ENERGIZED_EDGE_MAX_COUNTS 1900 ///< Rotary valve energized edge maximum allowed counts. +#define ROTARY_VALVE_ENERGIZED_EDGE_MIN_COUNTS 1700 ///< Rotary valve energized edge minimum allowed counts. /// rotary pinch valve names typedef enum valveNames { - H1_VALV = 0, ///< Arterial rotary pinch valve - FIRST_VALVE = H1_VALV, ///< First valve - H19_VALV, ///< Venous rotary pinch valve - NUM_OF_VALVES ///< Number of valves + H1_VALV = 0, ///< Arterial rotary pinch valve + FIRST_VALVE = H1_VALV, ///< First valve + H19_VALV, ///< Venous rotary pinch valve + NUM_OF_VALVES ///< Number of valves } VALVE_T; // ********** public function prototypes ********** Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r4a65377085c075e15056b4157e17e7ed0ec15301 -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 4a65377085c075e15056b4157e17e7ed0ec15301) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) @@ -967,7 +967,7 @@ { U32 treatmentTime = MIN_TREATMENT_TIME_MINUTES; - if ( TRUE == getTestConfigStatus( TEST_CONFIG_ENABLE_ONE_MINUTE_TREATMENT ) ) + //if ( TRUE == getTestConfigStatus( TEST_CONFIG_ENABLE_ONE_MINUTE_TREATMENT ) ) { treatmentTime = 1; } Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -re7fc14ea1f82609c49bd3e82480523fe312a27f2 -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision e7fc14ea1f82609c49bd3e82480523fe312a27f2) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) @@ -48,6 +48,7 @@ #define FPGA_H4_ENABLE_BIT_MASK 0x01 ///< Bit mask for enabling the blood pump. #define FPGA_H4_DIR_FORWARD_BIT_MASK 0x02 ///< Bit mask for setting the blood pump direction. #define FPGA_H4_BRAKE_AND_HOLD_TORQUE 0x06 ///< Bit mask for braking the blood pump while holding the torque of the pump. +#define FPGA_H4_BIT_2_INDEX 2 ///< Blood pump bit 2 index. #define FPGA_H13_OPEN_BIT_MASK 0x01 ///< Bit mask for setting H13 valve position to open. #define FPGA_H20_OPEN_BIT_MASK 0x02 ///< Bit mask for setting H20 valve position to open. @@ -478,7 +479,8 @@ { if ( MOTOR_DIR_FORWARD == dir ) { - fpgaActuatorSetPoints.h4Control &= ~( 1 << 2 ); + // First clear bit 2 if it is on otherwise the pump can be kept on brake + fpgaActuatorSetPoints.h4Control &= ~( 1 << FPGA_H4_BIT_2_INDEX ); fpgaActuatorSetPoints.h4Control |= FPGA_H4_DIR_FORWARD_BIT_MASK; } else Index: firmware/App/TDCommon.h =================================================================== diff -u -reaff654b897f641b874e3ba30a22cbda3779e4a7 -ra074eec2ed7d04a1ea90072d7c9c013bf27a6e90 --- firmware/App/TDCommon.h (.../TDCommon.h) (revision eaff654b897f641b874e3ba30a22cbda3779e4a7) +++ firmware/App/TDCommon.h (.../TDCommon.h) (revision a074eec2ed7d04a1ea90072d7c9c013bf27a6e90) @@ -41,6 +41,7 @@ // #define TEST_USE_OFF_AS_STOP_BUTTON 1 // Alpha test re-purposing off button as a stop button #define TEST_NO_PRESSURE_CHECKS 1 // Alpha test with no pressure sensor checks // #define TEST_NO_STOP_CONSUME_CHECK 1 // Alpha test with no check for stop button timeout +// #define ASN_DEMO 1 #include #include