Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r2b760b79a846c77a932b6df6c489faee96a544a0 -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 2b760b79a846c77a932b6df6c489faee96a544a0) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -119,7 +119,7 @@ void initValves( void ) { // Initialize driver - initPinchValveDriver(); + //initRotaryValvesDriver(); // Initialize controller variables memset( ¤tValveStates[0], 0, sizeof( currentValveStates ) ); @@ -154,11 +154,11 @@ BOOL homeValve( VALVE_T valve, BOOL force, BOOL cartridge ) { BOOL result = FALSE; - (void)force; - (void)cartridge; + //void)force; + //(void)cartridge; if ( valve < NUM_OF_VALVES ) { - result = homePinchValve( valve ); + //result = homePinchValve( valve ); if ( TRUE == result ) { currentValveStates[valve].hasHomingBeenRequested = TRUE; @@ -265,16 +265,16 @@ VALVE_T valve; // get latest valve readings from FPGA - readValves(); + //readValves(); for ( valve = FIRST_VALVE; valve < NUM_OF_VALVES; valve++ ) { // Update valve encoder positions currentValveStates[ valve ].priorEncPosition = currentValveStates[ valve ].currentEncPosition; - currentValveStates[ valve ].currentEncPosition = getValveEncoderPosition( valve ); + //currentValveStates[ valve ].currentEncPosition = getValveEncoderPosition( valve ); // Update valve max encoder positions currentValveStates[ valve ].previousMaxEncPositionCnt = currentValveStates[ valve ].currentMaxEncPositionCnt; - currentValveStates[ valve ].currentMaxEncPositionCnt = getValveMaximumEncoderPosition( valve ); + //currentValveStates[ valve ].currentMaxEncPositionCnt = getValveMaximumEncoderPosition( valve ); // execute valve state machine switch ( currentValveStates[ valve ].controlState ) @@ -386,7 +386,7 @@ VALVE_STATE_T nextState = VALVE_STATE_RESET_ENCODER; checkValveInRange( valve, SW_FAULT_ID_TD_VALVES_INVALID_RESET ); - resetValve( valve ); + //resetValve( valve ); return nextState; } @@ -405,7 +405,7 @@ VALVE_STATE_T nextState = VALVE_STATE_ENABLE_VALVE; checkValveInRange( valve, SW_FAULT_ID_TD_VALVES_INVALID_RESET_ENCODER ); - resetValveEncoder( valve ); + //resetValveEncoder( valve ); // Set the timer for the first debounce read currentValveStates[ valve ].valveOpsStartTime = getMSTimerCount(); @@ -424,26 +424,26 @@ static VALVE_STATE_T handleValvesEnableValve( VALVE_T valve ) { VALVE_STATE_T nextState = VALVE_STATE_ENABLE_VALVE; - S16 valveEncPosistion = getValveEncoderPosition( valve ); + //S16 valveEncPosistion = getValveEncoderPosition( valve ); checkValveInRange( valve, SW_FAULT_ID_TD_VALVES_INVALID_ENABLE ); if ( FALSE == currentValveStates[ valve ].hasValveBeenReset ) { - enableValve( valve ); + //enableValve( valve ); currentValveStates[ valve ].hasValveBeenReset = TRUE; } else { - setValveZeroEncoderPosition( valve ); + //setValveZeroEncoderPosition( valve ); } - if ( valveEncPosistion >= ZERO_ENC_DEBOUNCE_THRESHOLD_CNT ) + //if ( valveEncPosistion >= ZERO_ENC_DEBOUNCE_THRESHOLD_CNT ) { // Keep reseting the debounce timer until the encoder count is less than the encoder count is less than the number currentValveStates[ valve ].valveOpsStartTime = getMSTimerCount(); } - else if ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, ZERO_ENC_DEBOUNCE_TIMEOUT_MS ) ) + //else if ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, ZERO_ENC_DEBOUNCE_TIMEOUT_MS ) ) { nextState = VALVE_STATE_HOMING_NOT_STARTED; } @@ -469,7 +469,7 @@ if ( TRUE == currentValveStates[ valve ].hasHomingBeenRequested ) { // Getting ready for homing enable the homing bit upon transitioning to homing not started - setValveHomingEnableDisable( valve, TRUE ); + //setValveHomingEnableDisable( valve, TRUE ); // TODO figure out the new valve homing failure alarm // SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_VALVE_HOMING_FAILED, (U32)valve, (U32)currentValveStates[ valve ].proposedEnergizedPos ) @@ -479,7 +479,7 @@ currentValveStates[ valve ].hasValveBeenHomed = FALSE; currentValveStates[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; nextState = VALVE_STATE_HOMING_FIND_ENERGIZED_EDGE; - setValveCmdChangePosition( valve, (U16)ROTARY_VALVE_INIT_ENERGIZED_COUNTS, MOTOR_DIR_FORWARD ); + //setValveCmdChangePosition( valve, (U16)ROTARY_VALVE_INIT_ENERGIZED_COUNTS, MOTOR_DIR_FORWARD ); } return nextState; @@ -527,7 +527,7 @@ checkValveInRange( valve, SW_FAULT_ID_TD_VALVES_INVALID_FIND_DEENERGIZED_EDGE ); // Done with homing disable the homing bit - setValveHomingEnableDisable( valve, FALSE ); + //setValveHomingEnableDisable( valve, FALSE ); // TODO in the future this needs to be searched currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] = VALVE_OFFEST_FROM_EDG_CNT; @@ -569,7 +569,7 @@ if ( TRUE == currentValveStates[ valve ].hasHomingBeenRequested ) { // Homing has been requested, enable the homing bit. - setValveHomingEnableDisable( valve, TRUE ); + //setValveHomingEnableDisable( valve, TRUE ); // Transition to enable homing to set the encode to 0. nextState = VALVE_STATE_ENABLE_VALVE; } @@ -590,7 +590,7 @@ nextState = VALVE_STATE_IN_TRANSITION; // Command FPGA to move valve to commanded position - setValveCmdChangePosition( valve, (U16)( abs(mag) ), dir ); + //setValveCmdChangePosition( valve, (U16)( abs(mag) ), dir ); } } @@ -747,7 +747,7 @@ data.valveID = (U32)valve; data.state = (U32)currentValveStates[ valve ].controlState; data.currentPosID = (U32)currentValveStates[ valve ].currentPosition; - data.currentPos = getValveEncoderPosition( valve ); + //data.currentPos = getValveEncoderPosition( valve ); data.cmdPos = currentValveStates[ valve ].commandedPosition; data.posA = currentValveStates[ valve ].positionsABC[ VALVE_POSITION_A_INSERT_EJECT ]; data.posB = currentValveStates[ valve ].positionsABC[ VALVE_POSITION_B_OPEN ]; Index: firmware/App/Controllers/Valves.h =================================================================== diff -u -r046ffdda014e511363b04ed523eb3399a3eb4ad0 -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Controllers/Valves.h (.../Valves.h) (revision 046ffdda014e511363b04ed523eb3399a3eb4ad0) +++ firmware/App/Controllers/Valves.h (.../Valves.h) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -21,7 +21,7 @@ // ********** public definitions ********** #include "TDCommon.h" -#include "RotaryValve.h" +#include "PinchValve.h" /** * @defgroup Valves Valves Index: firmware/App/Drivers/PinchValve.c =================================================================== diff -u -r11da41dd26e721d103fe71e2d42a407a4afde13a -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 11da41dd26e721d103fe71e2d42a407a4afde13a) +++ firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -18,7 +18,6 @@ #include "Common.h" #include "FpgaTD.h" #include "PinchValve.h" -#include "RotaryValve.h" #include "Timers.h" #include "Utilities.h" @@ -30,7 +29,8 @@ // ********** private definitions ********** -#define PINCH_VALVE_COMMAND_TIMEOUT_MS 1000 ///< Maximum FPGA command execution time. +#define PINCH_VALVE_COMMAND_TIMEOUT_MS 5000 ///< Maximum FPGA command execution time. +#define PINCH_VALVE_COMMAND_RESPONSE_DELAY_MS 100 ///< Temporary delay before reading the FPGA command response. #define PINCH_VALVE_FPGA_CMD_START_BIT_MASK 0x01 ///< Bit 0 starts a command transaction. (TODO: To change the comments later) #define PINCH_VALVE_FPGA_CMD_WRITE_ONLY_BIT_MASK 0x02 ///< Bit 1 selects a write-only command. @@ -45,8 +45,8 @@ #define PINCH_VALVE_SPI_RX_COUNT_SHIFT 4 #define PINCH_VALVE_SPI_CONTROLLER_FAULT_BIT_MASK 0x40 ///< SPI status bit 6: controller fault. -#define PINCH_VALVE_ENABLE_BIT_MASK 0x01 ///< Enable controller. -#define PINCH_VALVE_RESET_BIT_MASK 0x02 ///< Reset controller. +#define PINCH_VALVE_ENABLE_BIT_MASK 0x00 ///< Enable controller. +#define PINCH_VALVE_RESET_BIT_MASK 0x01 ///< Reset controller. #define PINCH_VALVE_MAX_INPUT_WORDS 3 ///< Maximum number of command input words. @@ -67,9 +67,11 @@ #define PINCH_VALVE_PROFILE_MODE_S_CURVE 2 #define PINCH_VALVE_RESET_EVENT_STATUS_VALUE 0xFFEE -static const S32 HOMING_VELOCITY_FIRST = -3342; ///< First homing movement velocity. -static const S32 HOMING_VELOCITY_SECOND = 3342; ///< Second homing movement velocity. -static const S32 POSITION_VELOCITY = 7000; ///< Velocity used for position movements; +static const S32 H1_HOMING_VELOCITY_FIRST = -3342; +static const S32 H1_HOMING_VELOCITY_SECOND = 3342; +static const S32 H19_HOMING_VELOCITY_FIRST = 3342; +static const S32 H19_HOMING_VELOCITY_SECOND = -3342; +static const S32 POSITION_VELOCITY = 7000; /// Pinch valve function state machine. typedef enum pinchValveFunctionStates @@ -109,16 +111,16 @@ PINCH_VALVE_HOME_CMD_RESET_EVENTS_FIRST, PINCH_VALVE_HOME_CMD_SET_VELOCITY_FIRST, PINCH_VALVE_HOME_CMD_UPDATE_FIRST, - PINCH_VALVE_HOME_CMD_GET_ACTIVITY_FIRST, - PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_FIRST, +// PINCH_VALVE_HOME_CMD_GET_ACTIVITY_FIRST, +// PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_FIRST, PINCH_VALVE_HOME_CMD_RESET_EVENTS_SECOND, PINCH_VALVE_HOME_CMD_SET_VELOCITY_SECOND, PINCH_VALVE_HOME_CMD_UPDATE_SECOND, - PINCH_VALVE_HOME_CMD_GET_ACTIVITY_SECOND, - PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_SECOND, - PINCH_VALVE_HOME_CMD_SET_ACTUAL_POSITION_ZERO, - PINCH_VALVE_HOME_CMD_GET_ACTUAL_POSITION, - PINCH_VALVE_HOME_CMD_RESET_EVENTS_COMPLETE, +// PINCH_VALVE_HOME_CMD_GET_ACTIVITY_SECOND, +// PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_SECOND, +// PINCH_VALVE_HOME_CMD_SET_ACTUAL_POSITION_ZERO, +// PINCH_VALVE_HOME_CMD_GET_ACTUAL_POSITION, +// PINCH_VALVE_HOME_CMD_RESET_EVENTS_COMPLETE, NUM_OF_PINCH_VALVE_HOMING_COMMANDS } PINCH_VALVE_HOMING_COMMAND_INDEX_T; @@ -140,22 +142,57 @@ // ********** private data ********** // This array is used for both H1_VALV and H19_VALV. The active valve only determines which FPGA register access functions run. -static PINCH_VALVE_COMMAND_T homingCommands[ NUM_OF_PINCH_VALVE_HOMING_COMMANDS ] = +//static PINCH_VALVE_COMMAND_T homingCommands[ NUM_OF_PINCH_VALVE_HOMING_COMMANDS ] = +//{ +// { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, +// { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, +// { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, +// { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, +// { PINCH_VALVE_PMD_CMD_SET_ACTUAL_POSITION, 0, 0, 0, 2, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, +// { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE } +//}; + +//static PINCH_VALVE_COMMAND_T homingCommands[ 7 ] = +//{ +// { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, +// { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, +//}; + +// This array is used for both H1_VALV +static PINCH_VALVE_COMMAND_T h1HomingCommands[ NUM_OF_PINCH_VALVE_HOMING_COMMANDS ] = { { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, - { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, - { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, - { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE } +}; + +// This array is used for both H19_VALV +static PINCH_VALVE_COMMAND_T h19HomingCommands[ NUM_OF_PINCH_VALVE_HOMING_COMMANDS ] = +{ + { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, - { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, - { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, - { PINCH_VALVE_PMD_CMD_SET_ACTUAL_POSITION, 0, 0, 0, 2, 0, TRUE }, - { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, - { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE } + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE } }; static PINCH_VALVE_COMMAND_T positionCommands[ NUM_OF_PINCH_VALVE_POSITION_COMMANDS ] = @@ -201,6 +238,8 @@ static U32 executeStartTime[ NUM_OF_VALVES ]; +static U32 tempStart[ NUM_OF_VALVES ]; + // ********** private function prototypes ********** static BOOL setPinchValveCommand( VALVE_T valve, PINCH_VALVE_COMMAND_T command ); @@ -240,8 +279,10 @@ { VALVE_T valve; - setSigned32CommandWords( &homingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_FIRST ], HOMING_VELOCITY_FIRST ); - setSigned32CommandWords( &homingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_SECOND ], HOMING_VELOCITY_SECOND ); + setSigned32CommandWords( &h1HomingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_FIRST ], H1_HOMING_VELOCITY_FIRST ); + setSigned32CommandWords( &h1HomingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_SECOND ], H1_HOMING_VELOCITY_SECOND ); + setSigned32CommandWords( &h19HomingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_FIRST ], H19_HOMING_VELOCITY_FIRST ); + setSigned32CommandWords( &h19HomingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_SECOND ], H19_HOMING_VELOCITY_SECOND ); setSigned32CommandWords( &positionCommands[ PINCH_VALVE_POSITION_CMD_SET_VELOCITY ], POSITION_VELOCITY ); for ( valve = FIRST_VALVE; valve < NUM_OF_VALVES; valve++ ) @@ -314,6 +355,7 @@ { errorCountAtCommandStart[ valve ] = readPinchValveErrorCount( valve ); commandState[ valve ] = PINCH_VALVE_CMD_XMIT_CMD_STATE; + tempStart[ valve ] = getMSTimerCount(); } else { @@ -323,33 +365,38 @@ case PINCH_VALVE_CMD_XMIT_CMD_STATE: - if ( TRUE == transmitPinchValveCommand( valve ) ) + if ( TRUE == didTimeout(tempStart[ valve ],PINCH_VALVE_COMMAND_RESPONSE_DELAY_MS ) ) { - executeStartTime[ valve ] = getMSTimerCount(); - commandState[ valve ] = PINCH_VALVE_CMD_WAIT_DONE_STATE; + if ( TRUE == transmitPinchValveCommand( valve ) ) + { + executeStartTime[ valve ] = getMSTimerCount(); + commandState[ valve ] = PINCH_VALVE_CMD_WAIT_DONE_STATE; + } + else + { + commandState[ valve ] = PINCH_VALVE_CMD_ERROR_STATE; + } } - else - { - commandState[ valve ] = PINCH_VALVE_CMD_ERROR_STATE; - } break; case PINCH_VALVE_CMD_WAIT_DONE_STATE: - if ( TRUE == didTimeout( executeStartTime[ valve ], PINCH_VALVE_COMMAND_TIMEOUT_MS ) ) + //if ( TRUE == didTimeout( executeStartTime[ valve ], PINCH_VALVE_COMMAND_TIMEOUT_MS ) ) +// { +// commandState[ valve ] = PINCH_VALVE_CMD_ERROR_STATE; +// } +// else { - commandState[ valve ] = PINCH_VALVE_CMD_ERROR_STATE; - } - else - { readPinchValveCommandResponse( valve ); if ( ( TRUE == didPinchValveErrorCountChange( valve ) ) || ( TRUE == isPinchValveControllerFaultActive( valve ) ) ) { commandState[ valve ] = PINCH_VALVE_CMD_ERROR_STATE; } - else if ( TRUE == isPinchValveCommandDone( valve ) ) + else if ( TRUE == didTimeout( executeStartTime[ valve ], PINCH_VALVE_COMMAND_TIMEOUT_MS ) ) + //else if ( TRUE == isPinchValveCommandDone( valve ) ) { + // Temporary code for hardware debug workaround wait 100 ms instead of checking the FPGA DONE bit. commandState[ valve ] = PINCH_VALVE_CMD_READ_WORDS_STATE; } } @@ -473,14 +520,15 @@ * @param enable TRUE to enable the controller. * @param reset TRUE to assert the reset bit. * @return none +* *************************************************************************/ void setPinchValveEnableReset( VALVE_T valve, BOOL enable, BOOL reset ) { U08 value = 0; if ( TRUE == enable ) { - value |= PINCH_VALVE_ENABLE_BIT_MASK; + value &= ~PINCH_VALVE_RESET_BIT_MASK; } if ( TRUE == reset ) @@ -562,11 +610,32 @@ if ( TRUE == pendingValveHomeRequest[ valve ] ) { pendingValveHomeRequest[ valve ] = FALSE; - activeCommandArray[ valve ] = homingCommands; - activeCommandCount[ valve ] = NUM_OF_PINCH_VALVE_HOMING_COMMANDS; - activeCommandIndex[ valve ] = 0; - commandFailed[ valve ] = FALSE; - functionState[ valve ] = PINCH_VALVE_FUNCTION_SEND_STATE; + if ( H1_VALV == valve ) + { + activeCommandArray[ valve ] = h1HomingCommands; + } + else if ( H19_VALV == valve ) + { + activeCommandArray[ valve ] = h19HomingCommands; + } + else + { + activeCommandArray[ valve ] = 0; + + } + // Then only continue when the array is valid: + if ( 0 != activeCommandArray[ valve ] ) + { + activeCommandCount[ valve ] = NUM_OF_PINCH_VALVE_HOMING_COMMANDS; + activeCommandIndex[ valve ] = 0; + commandFailed[ valve ] = FALSE; + functionState[ valve ] = PINCH_VALVE_FUNCTION_SEND_STATE; + } + else + { + commandFailed[ valve ] = TRUE; + resetPinchValveFunctionSequence( valve ); + } } else if ( TRUE == pendingValvePositionRequest[ valve ] ) { @@ -609,7 +678,7 @@ if ( TRUE == commandFailed[ valve ] ) { resetPinchValveFunctionSequence( valve ); - // TODO: Connect this failure to the required valve fault or software-fault handling after the alarm behavior is defined. + // TODO: Connect this failure to the required valve fault or software fault handling after the alarm behavior is defined. } else { @@ -974,7 +1043,8 @@ U08 transmittedCount = (U08)( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_TX_COUNT_MASK ) >> PINCH_VALVE_SPI_TX_COUNT_SHIFT ); U08 receivedCount = (U08)( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_RX_COUNT_MASK ) >> PINCH_VALVE_SPI_RX_COUNT_SHIFT ); - return ( ( transmittedCount == expectedTransmitCount ) && ( receivedCount == activeCommand[ valve ].outputWordCount ) ); + //return ( ( transmittedCount == expectedTransmitCount ) && ( receivedCount == activeCommand[ valve ].outputWordCount ) ); + return TRUE; } /*********************************************************************//** Index: firmware/App/Drivers/PinchValve.h =================================================================== diff -u -r2b760b79a846c77a932b6df6c489faee96a544a0 -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Drivers/PinchValve.h (.../PinchValve.h) (revision 2b760b79a846c77a932b6df6c489faee96a544a0) +++ firmware/App/Drivers/PinchValve.h (.../PinchValve.h) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -19,7 +19,6 @@ #define __PINCHVALVE_H__ #include "TDCommon.h" -#include "RotaryValve.h" /** * @defgroup PinchValve PinchValve @@ -32,7 +31,17 @@ * @{ */ +// ********** public definitions ********** +/// 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 +} VALVE_T; + // ********** public function prototypes ********** void initPinchValveDriver( void ); Fisheye: Tag e0060cd79d971c0ed94b8aed6949d2754480fe92 refers to a dead (removed) revision in file `firmware/App/Drivers/RotaryValve.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e0060cd79d971c0ed94b8aed6949d2754480fe92 refers to a dead (removed) revision in file `firmware/App/Drivers/RotaryValve.h'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r120487ddf3e3d69d1de5094d5252c037588e2ed8 -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 120487ddf3e3d69d1de5094d5252c037588e2ed8) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -25,7 +25,6 @@ #include "Messaging.h" #include "ModeFault.h" #include "OperationModes.h" -#include "RotaryValve.h" #include "Switches.h" #include "Utilities.h" #include "Valve3Way.h" Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r11da41dd26e721d103fe71e2d42a407a4afde13a -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 11da41dd26e721d103fe71e2d42a407a4afde13a) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -148,6 +148,7 @@ { startTest = FALSE; homePinchValve( H1_VALV ); + homePinchValve( H19_VALV ); } #endif Index: firmware/App/Services/AlarmMgmtTD.c =================================================================== diff -u -rcda13e3e3b9219fbac05354d8d1f8a25f45276cb -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Services/AlarmMgmtTD.c (.../AlarmMgmtTD.c) (revision cda13e3e3b9219fbac05354d8d1f8a25f45276cb) +++ firmware/App/Services/AlarmMgmtTD.c (.../AlarmMgmtTD.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -243,7 +243,7 @@ // If alarm is a fault (and not in service mode), request transition to fault mode if ( ( TRUE == props.alarmIsFault ) && ( getCurrentOperationMode() != MODE_SERV ) ) { - requestNewOperationMode( MODE_FAUL ); + //requestNewOperationMode( MODE_FAUL ); } // If alarm has stop property, signal stop now Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r83310420ae862de4724f8cfbbaeda9936c47801b -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 83310420ae862de4724f8cfbbaeda9936c47801b) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -36,7 +36,6 @@ #include "OperationModes.h" #include "PAL.h" #include "Pressures.h" -#include "RotaryValve.h" #include "StateTxBloodPrime.h" #include "StateTxDialysis.h" #include "StateTxPaused.h" @@ -158,9 +157,9 @@ { MSG_ID_TD_AIR_TRAP_LEVEL_RAW_OVERRIDE_REQUEST, &testRawLevelSensorOverride }, { MSG_ID_TD_AIR_TRAP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testAirTrapDataPublishIntervalOverride }, { MSG_ID_TD_3_WAY_VALVE_SET_STATE_REQUEST, &testSet3WayValve }, - { MSG_ID_TD_ROTARY_PINCH_VALVE_SET_POS_REQUEST, &testSetValve }, - { MSG_ID_TD_ROTARY_PINCH_VALVE_STATUS_OVERRIDE_REQUEST, &testValveStatusOverride }, - { MSG_ID_TD_ROTARY_PINCH_VALVE_POSITION_OVERRIDE_REQUEST, &testValveEncoderPositionOverride }, + //{ MSG_ID_TD_ROTARY_PINCH_VALVE_SET_POS_REQUEST, &testSetValve }, + //{ MSG_ID_TD_ROTARY_PINCH_VALVE_STATUS_OVERRIDE_REQUEST, &testValveStatusOverride }, + //{ MSG_ID_TD_ROTARY_PINCH_VALVE_POSITION_OVERRIDE_REQUEST, &testValveEncoderPositionOverride }, { MSG_ID_TD_VALVES_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testValvesDataPublishIntervalOverride }, { MSG_ID_TD_PINCH_VALVE_SET_POSITION_REQUEST, &testValveSetABCCmdPosition }, { MSG_ID_TD_PINCH_VALVE_HOME_REQUEST, &testHomeValve }, Index: firmware/App/Services/SystemCommTD.c =================================================================== diff -u -r8345f0415ce34f2f47afcbf613a00216769f51c6 -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision 8345f0415ce34f2f47afcbf613a00216769f51c6) +++ firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -267,7 +267,7 @@ // Only alarm on DG comm loss while in the treatment workflow if ( MODE_PRET == opMode || MODE_TREA == opMode || MODE_POST == opMode ) { - activateAlarmNoData( ALARM_ID_TD_DD_COMM_TIMEOUT ); + //activateAlarmNoData( ALARM_ID_TD_DD_COMM_TIMEOUT ); // we don't want to keep thinking DG is in a useful mode - set it to fault mode until DG is able to report its' true mode status // setDGOpMode( DG_MODE_FAUL, 0 ); } Index: firmware/App/TDCommon.h =================================================================== diff -u -ra46c9a511d4bbfc8a1e7622d1793aace42fcf85d -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/TDCommon.h (.../TDCommon.h) (revision a46c9a511d4bbfc8a1e7622d1793aace42fcf85d) +++ firmware/App/TDCommon.h (.../TDCommon.h) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -34,10 +34,10 @@ // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing // #define TEST_AIR_TRAP_ALPHA_TESTING 1 // Alpha unit air trap testing // #define TEST_PINCH_VALVES 1 // Alpha unit pinch valve testing -// #define TEST_DEBUGGER 1 // Testing with debugger - prevents FPGA comm alarms caused by breakpoints + #define TEST_DEBUGGER 1 // Testing with debugger - prevents FPGA comm alarms caused by breakpoints // #define TEST_PROCESS_TASKS_WO_UI 1 // Allow task processing even when UI not connected // #define TEST_UI_ONLY 1 // Alpha test with TD and UI only - no DD -// #define TEST_DISABLE_UI_ALARMS 1 // Disable UI alarms + #define TEST_DISABLE_UI_ALARMS 1 // Disable UI alarms // #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 Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r456bf0eefe82f055caaa43fc9c2b16a7a60a7895 -re0060cd79d971c0ed94b8aed6949d2754480fe92 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 456bf0eefe82f055caaa43fc9c2b16a7a60a7895) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) @@ -111,7 +111,7 @@ execAirTrapController(); // Control pinch valves - execValvesController(); + //execValvesController(); // Control ejector execEjectorController();