Index: firmware/App/Drivers/PinchValve.c =================================================================== diff -u -r4c738395b1627aa36f30c14c2e374acf0e88f5f8 -r7789bde9c85a539a256f00d1b029a9ebf33dac46 --- firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 4c738395b1627aa36f30c14c2e374acf0e88f5f8) +++ firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 7789bde9c85a539a256f00d1b029a9ebf33dac46) @@ -85,160 +85,160 @@ PINCH_VALVE_FUNCTION_WAIT_STATE ///< Waits for the current command to finish } PINCH_VALVE_FUNCTION_STATE_T; -/// Low-level FPGA command state machine. +/// Pinch Valve FPGA command state machine. typedef enum pinchValveCommandStates { - PINCH_VALVE_CMD_IDLE_STATE = 0, - PINCH_VALVE_CMD_SET_CMD_STATE, - PINCH_VALVE_CMD_XMIT_CMD_STATE, - PINCH_VALVE_CMD_WAIT_DONE_STATE, - PINCH_VALVE_CMD_READ_WORDS_STATE, - PINCH_VALVE_CMD_ERROR_STATE + PINCH_VALVE_CMD_IDLE_STATE = 0, ///< Waits for a new command. + PINCH_VALVE_CMD_SET_CMD_STATE, ///< Writes the command header and input words to FPGA registers + PINCH_VALVE_CMD_XMIT_CMD_STATE, ///< Starts the FPGA command transmit. + PINCH_VALVE_CMD_WAIT_DONE_STATE, ///< Waits for command completion and the expected receive word count. + PINCH_VALVE_CMD_READ_WORDS_STATE, ///< Processes the completed command response. + PINCH_VALVE_CMD_ERROR_STATE ///< Clears the command and reports command failure } PINCH_VALVE_CMD_STATE_T; /// Pinch valve command request. typedef struct { - U16 cmdHeader; ///< Command header. - U16 inputWord1; ///< Input word 1. - U16 inputWord2; ///< Input word 2. - U16 inputWord3; ///< Input word 3. - U08 inputWordCount; ///< Number of valid input words, excluding the command header. - U08 outputWordCount; ///< Number of output words expected. - BOOL writeOnly; ///< TRUE for a write-only command. + U16 cmdHeader; ///< Command header. + U16 inputWord1; ///< Input word 1. + U16 inputWord2; ///< Input word 2. + U16 inputWord3; ///< Input word 3. + U08 inputWordCount; ///< Number of valid input words, excluding the command header. + U08 outputWordCount; ///< Number of output words expected. + BOOL writeOnly; ///< TRUE for a write-only command. } PINCH_VALVE_COMMAND_T; -/// Pinch Valve Command for Homing. +/// Pinch Valve Command for Homing sequence typedef enum pinchValveHomingCommandIndexes { - PINCH_VALVE_HOME_CMD_SET_PROFILE_MODE = 0, - 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_ACTUAL_POSITION_B, - 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_GET_ACTUAL_POSITION_C, - PINCH_VALVE_HOME_CMD_RESET_EVENTS_COMPLETE, - PINCH_VALVE_HOME_CMD_SET_PROFILE_MODE_SECOND, - PINCH_VALVE_HOME_CMD_SET_VELOCITY_THIRD, - PINCH_VALVE_HOME_CMD_UPDATE_THIRD, - PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_THIRD, - NUM_OF_PINCH_VALVE_HOMING_COMMANDS + PINCH_VALVE_HOME_CMD_SET_PROFILE_MODE = 0, ///< Pinch valve home command set profile mode. + PINCH_VALVE_HOME_CMD_RESET_EVENTS_FIRST, ///< Pinch valve home command reset events first + PINCH_VALVE_HOME_CMD_SET_VELOCITY_FIRST, ///< Pinch valve home command set velocity first + PINCH_VALVE_HOME_CMD_UPDATE_FIRST, ///< Pinch valve home command update first + PINCH_VALVE_HOME_CMD_GET_ACTIVITY_FIRST, ///< Pinch valve home command get activity first + PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_FIRST, ///< Pinch valve home command get event status first + PINCH_VALVE_HOME_CMD_GET_ACTUAL_POSITION_B, ///< Pinch valve home command get actual position B + PINCH_VALVE_HOME_CMD_RESET_EVENTS_SECOND, ///< Pinch valve home command reset events second + PINCH_VALVE_HOME_CMD_SET_VELOCITY_SECOND, ///< Pinch valve home command set velocity second + PINCH_VALVE_HOME_CMD_UPDATE_SECOND, ///< Pinch valve home command update second + PINCH_VALVE_HOME_CMD_GET_ACTIVITY_SECOND, ///< Pinch valve home command get activity second + PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_SECOND, ///< Pinch valve home command get event status second + PINCH_VALVE_HOME_CMD_GET_ACTUAL_POSITION_C, ///< Pinch valve home command get actual position C + PINCH_VALVE_HOME_CMD_RESET_EVENTS_COMPLETE, ///< Pinch valve home command reset events complete + PINCH_VALVE_HOME_CMD_SET_PROFILE_MODE_SECOND, ///< Pinch valve home command set profile mode second + PINCH_VALVE_HOME_CMD_SET_VELOCITY_THIRD, ///< Pinch valve home command set velocity third + PINCH_VALVE_HOME_CMD_UPDATE_THIRD, ///< Pinch valve home command update third + PINCH_VALVE_HOME_CMD_GET_EVENT_STATUS_THIRD, ///< Pinch valve home command get event status third + NUM_OF_PINCH_VALVE_HOMING_COMMANDS ///< Number of pinch valve in the homing commands } PINCH_VALVE_HOMING_COMMAND_INDEX_T; -/// Pinch Valve Command for Set-Position. +/// Pinch Valve Command for stored position movement sequence. typedef enum pinchValvePositionCommandIndexes { - PINCH_VALVE_POSITION_CMD_RESET_EVENT_STATUS = 0, - PINCH_VALVE_POSITION_CMD_SET_POSITION, - PINCH_VALVE_POSITION_CMD_UPDATE, - PINCH_VALVE_POSITION_CMD_GET_ACTIVITY_STATUS, - PINCH_VALVE_POSITION_CMD_GET_EVENT_STATUS, - PINCH_VALVE_POSITION_CMD_GET_ACTUAL_POSITION, - PINCH_VALVE_POSITION_CMD_RESET_EVENT_STATUS_COMPLETE, - NUM_OF_PINCH_VALVE_POSITION_COMMANDS + PINCH_VALVE_POSITION_CMD_RESET_EVENT_STATUS = 0, ///< Pinch valve position command reset event status + PINCH_VALVE_POSITION_CMD_SET_POSITION, ///< Pinch valve position command set position + PINCH_VALVE_POSITION_CMD_UPDATE, ///< Pinch valve position command update + PINCH_VALVE_POSITION_CMD_GET_ACTIVITY_STATUS, ///< Pinch valve position command get activity status + PINCH_VALVE_POSITION_CMD_GET_EVENT_STATUS, ///< Pinch valve position command get event status + PINCH_VALVE_POSITION_CMD_GET_ACTUAL_POSITION, ///< Pinch valve position command get actual position + PINCH_VALVE_POSITION_CMD_RESET_EVENT_STATUS_COMPLETE, ///< Pinch valve position command reset event status complete + NUM_OF_PINCH_VALVE_POSITION_COMMANDS ///< Number of pinch valve position commands } PINCH_VALVE_POSITION_COMMAND_INDEX_T; // ********** private data ********** // 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_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_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_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_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_S_CURVE, 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_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } + { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, // Selects velocity profile mode for homing + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits before the first homing movement + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, // Sets the velocity for the first homing movement. + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts the first homing movement. + { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, // Reads activity status after the first update + { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, // Polls event status until the first movement completes + { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, // Reads and stores for position B + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits before the second homing movement + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, // Sets the velocity for the second homing movement + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts the second homing movement. + { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, // Reads activity status after the second update + { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, // Polls event status until the second movement completes + { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, // Reads and stores for position C + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits after endpoint detection is complete. + { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_S_CURVE, 0, 0, 1, 0, TRUE }, // Selects the profile mode used to move to position A + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, // Sets the velocity used to move to position A + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts movement to the calculated position A. + { 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 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_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_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_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_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_S_CURVE, 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_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } + { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, // Selects velocity profile mode for homing + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits before the first homing movement + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, // Sets the velocity for the first homing movement. + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts the first homing movement. + { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, // Reads activity status after the first update + { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, // Polls event status until the first movement completes + { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, // Reads and stores for position B + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits before the second homing movement + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, // Sets the velocity for the second homing movement + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts the second homing movement + { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, // Reads activity status after the second update + { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, // Polls event status until the second movement completes + { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, // Reads and stores for position C + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits after endpoint detection is complete + { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_S_CURVE, 0, 0, 1, 0, TRUE }, // Selects the profile mode used to move to position A + { PINCH_VALVE_PMD_CMD_SET_VELOCITY, 0, 0, 0, 2, 0, TRUE }, // Sets the velocity used to move to position A + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts movement to the calculated position A. + { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } // Polls event status until the third movement completes }; 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 }, - { PINCH_VALVE_PMD_CMD_SET_POSITION, 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_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 }, // Clears event bits before position movement + { PINCH_VALVE_PMD_CMD_SET_POSITION, 0, 0, 0, 2, 0, TRUE }, // Writes the requested target encoder position + { PINCH_VALVE_PMD_CMD_UPDATE, 0, 0, 0, 0, 0, TRUE }, // Starts movement to the requested position + { PINCH_VALVE_PMD_CMD_GET_ACTIVITY_STATUS, 0, 0, 0, 0, 1, FALSE }, // Reads activity status after movement starts + { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE }, // Polls event status until movement completes + { PINCH_VALVE_PMD_CMD_GET_ACTUAL_POSITION, 0, 0, 0, 0, 2, FALSE }, // Reads the final actual encoder position + { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE } // Clears event bits after position movement completes }; -static PINCH_VALVE_FUNCTION_STATE_T functionState[ NUM_OF_VALVES ]; -static PINCH_VALVE_CMD_STATE_T commandState[ NUM_OF_VALVES ]; +static PINCH_VALVE_FUNCTION_STATE_T functionState[ NUM_OF_VALVES ]; ///< Current function state for each valve +static PINCH_VALVE_CMD_STATE_T commandState[ NUM_OF_VALVES ]; ///< Current command state for each valve -static PINCH_VALVE_COMMAND_T activeCommand[ NUM_OF_VALVES ]; -static PINCH_VALVE_COMMAND_T *activeCommandArray[ NUM_OF_VALVES ]; -static U08 activeCommandCount[ NUM_OF_VALVES ]; -static U08 activeCommandIndex[ NUM_OF_VALVES ]; +static PINCH_VALVE_COMMAND_T activeCommand[ NUM_OF_VALVES ]; ///< Command currently being executed for each valve +static PINCH_VALVE_COMMAND_T *activeCommandArray[ NUM_OF_VALVES ]; ///< Active homing or position command sequence for each valve +static U08 activeCommandCount[ NUM_OF_VALVES ]; ///< Number of commands in the active sequence for each valve +static U08 activeCommandIndex[ NUM_OF_VALVES ]; ///< Current command index within the active sequence -static BOOL pendingValveHomeRequest[ NUM_OF_VALVES ]; -static BOOL pendingValvePositionRequest[ NUM_OF_VALVES ]; -static BOOL commandFailed[ NUM_OF_VALVES ]; +static BOOL pendingValveHomeRequest[ NUM_OF_VALVES ]; ///< Pending homing request for each valve. +static BOOL pendingValvePositionRequest[ NUM_OF_VALVES ]; ///< Pending position request for each valve +static BOOL commandFailed[ NUM_OF_VALVES ]; ///< Current command failed for each valve. -static BOOL homingInProgress[ NUM_OF_VALVES ]; -static BOOL positionInProgress[ NUM_OF_VALVES ]; +static BOOL homingInProgress[ NUM_OF_VALVES ]; ///< Homing sequence is active for each valve. +static BOOL positionInProgress[ NUM_OF_VALVES ]; ///< Position sequence is active for each valve. -static S32 pendingValvePosition[ NUM_OF_VALVES ]; -static S32 currentValvePosition[ NUM_OF_VALVES ]; -static S32 valvePositions[ NUM_OF_VALVES ][ NUM_OF_VALVE_POSITIONS ]; +static S32 pendingValvePosition[ NUM_OF_VALVES ]; ///< Requested target encoder position for each valve. +static S32 currentValvePosition[ NUM_OF_VALVES ]; ///< Current encoder position reported for each valve. +static S32 valvePositions[ NUM_OF_VALVES ][ NUM_OF_VALVE_POSITIONS ]; ///< Stored encoder positions A, B, and C for each valve. -static U16 commandOutputWord1[ NUM_OF_VALVES ]; -static U16 commandOutputWord2[ NUM_OF_VALVES ]; -static U16 commandOutputWord3[ NUM_OF_VALVES ]; +static U16 commandOutputWord1[ NUM_OF_VALVES ]; ///< First command output word for each valve. +static U16 commandOutputWord2[ NUM_OF_VALVES ]; ///< Second command output word for each valve. +static U16 commandOutputWord3[ NUM_OF_VALVES ]; ///< Third command output word for each valve. -static U16 activityStatus[ NUM_OF_VALVES ]; -static U16 eventStatus[ NUM_OF_VALVES ]; +static U16 activityStatus[ NUM_OF_VALVES ]; ///< Current activity status word for each valve +static U16 eventStatus[ NUM_OF_VALVES ]; ///< Current event status word for each valve. -static U08 commandSpiStatus[ NUM_OF_VALVES ]; -static U08 commandErrorCount[ NUM_OF_VALVES ]; -static U08 errorCountAtCommandStart[ NUM_OF_VALVES ]; -static U08 enableResetValue[ NUM_OF_VALVES ]; -static U08 fpgaCommandValue[ NUM_OF_VALVES ]; +static U08 commandSpiStatus[ NUM_OF_VALVES ]; ///< Current FPGA SPI command status value for each valve. +static U08 commandErrorCount[ NUM_OF_VALVES ]; ///< Current FPGA command error count for each valve. +static U08 errorCountAtCommandStart[ NUM_OF_VALVES ]; ///< Error count captured before starting the current command. +static U08 enableResetValue[ NUM_OF_VALVES ]; ///< Last enable/reset value written for each valve. +static U08 fpgaCommandValue[ NUM_OF_VALVES ]; ///< FPGA command byte given for each valve. -static U32 executeStartTime[ NUM_OF_VALVES ]; +static U32 executeStartTime[ NUM_OF_VALVES ]; ///< Command execution start time used for transaction timeout detection -static U32 motionStartTime[ NUM_OF_VALVES ]; +static U32 motionStartTime[ NUM_OF_VALVES ]; ///< Motion start time used for valve movement timeout detection. // ********** private function prototypes **********