Index: firmware/App/Drivers/PinchValve.c =================================================================== diff -u -r88faf0b2c2b71c6d6b75637a11f7d5de41e351af -r6d2e13dfca9285909eddd958ca82bf3da1157412 --- firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 88faf0b2c2b71c6d6b75637a11f7d5de41e351af) +++ firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 6d2e13dfca9285909eddd958ca82bf3da1157412) @@ -152,7 +152,7 @@ // ********** private data ********** -/// This array is used for both H1_VALV +/// Command list for H1 homing function 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 }, // Selects velocity profile mode for homing @@ -175,7 +175,7 @@ { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } // Polls event status until the third movement completes }; -/// This array is used for both H19_VALV +/// Command list for H1 homing function 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 }, // Selects velocity profile mode for homing @@ -198,7 +198,7 @@ { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } // Polls event status until the third movement completes }; -/// This array is used for position commands +/// Command list for pinch valve position change function static PINCH_VALVE_COMMAND_T positionCommands[ NUM_OF_PINCH_VALVE_POSITION_COMMANDS ] = { { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits before position movement @@ -312,7 +312,7 @@ 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( &h19HomingCommands[ PINCH_VALVE_HOME_CMD_SET_VELOCITY_THIRD ], POSITION_VELOCITY ); - setSigned32CommandWords(&positionCommands[ PINCH_VALVE_POSITION_CMD_SET_VELOCITY ], POSITION_VELOCITY ); + setSigned32CommandWords( &positionCommands[ PINCH_VALVE_POSITION_CMD_SET_VELOCITY ], POSITION_VELOCITY ); for ( valve = FIRST_VALVE; valve < NUM_OF_VALVES; valve++ ) { @@ -686,7 +686,6 @@ return nextState; } - /*********************************************************************//** * @brief * The handlePinchValveFunctionSendState function submits the next command @@ -1203,18 +1202,11 @@ positionB = valvePositions[ valve ][ VALVE_POSITION_B_OPEN ]; positionC = valvePositions[ valve ][ VALVE_POSITION_C_CLOSE ]; valvePositions[ valve ][ VALVE_POSITION_A_INSERT_EJECT ] = positionB + ( ( positionC - positionB ) / 2 ); -// if ( H1_VALV == valve ) -// { -// setSigned32CommandWords( &h1HomingCommands[ PINCH_VALVE_HOME_CMD_SET_POSITION ], valvePositions[ valve ][ VALVE_POSITION_A_INSERT_EJECT ] ); -// } -// else if (H19_VALV == valve ) -// { -// setSigned32CommandWords( &h19HomingCommands[ PINCH_VALVE_HOME_CMD_SET_POSITION ], valvePositions[ valve ][ VALVE_POSITION_A_INSERT_EJECT ] ); -// } break; default: - break; + // unhandled position - do nothing + break; } } else @@ -1226,7 +1218,8 @@ break; default: - break; + // unhandled position - do nothing + break; } } } @@ -1367,6 +1360,7 @@ U08 transmittedCount; U08 receivedCount; + // TODO: Later to restore this // if ( TRUE == isValidPinchValve( valve ) ) // { // // Transmit count for command header. @@ -1386,7 +1380,6 @@ return result; } - /*********************************************************************//** * @brief * The readPinchValveErrorCount function reads the current error count for @@ -1511,9 +1504,16 @@ *************************************************************************/ static BOOL isValidPinchValvePosition( VALVE_POSITION_T position ) { - BOOL result; + BOOL result = FALSE; - result = ( ( position > VALVE_POSITION_NOT_IN_POSITION ) && ( position < NUM_OF_VALVE_POSITIONS ) ); + if ( ( position > VALVE_POSITION_NOT_IN_POSITION ) && ( position < NUM_OF_VALVE_POSITIONS ) ) + { + result = TRUE; + } + else + { + result = FALSE; + } return result; }