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 ];