Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r85457b793bef9f18e2d04cbc8f901c138eae3609 -r3477dd649f67442ad4bdea810ce5a251c1b0a2bf --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 85457b793bef9f18e2d04cbc8f901c138eae3609) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 3477dd649f67442ad4bdea810ce5a251c1b0a2bf) @@ -17,121 +17,164 @@ // ********** private definitions ********** // Valve dialyzer inlet defines -#define VDI_ENABLE_PID_INTERFACE 0x0010 -#define VDI_ENABLE_BYPASS_INTERFACE 0x0020 +#define VDI_SET_PID_BIT_MASK 0x0010 ///< VDI enable PID bit mask +#define VDI_SET_BYPASS_BIT_MASK 0x0020 ///< VDI enable bypass bit mask +#define VDI_RESET_CONTROL_BIT_MASK 0x03CF ///< VDI reset control bit mask -#define VDI_INIT_STATUS_BIT_MASK 0x0040 -#define VDI_ENABLE_PID_STATUS_BIT_MASK 0x0080 -#define VDI_ENABLE_BYPASS_STATUS_BIT_MASK 0x00100 +#define VDI_INIT_STATUS_BIT_MASK 0x0040 ///< VDI init status bit mask +#define VDI_ENABLE_PID_STATUS_BIT_MASK 0x0080 ///< VDI PID status bit mask +#define VDI_ENABLE_BYPASS_STATUS_BIT_MASK 0x0100 ///< VDI bypass status bit mask // Valve dialyzer outlet defines -#define VDO_ENABLE_PID_INTERFACE 0x0040 -#define VDO_ENABLE_BYPASS_INTERFACE 0x0080 +#define VDO_SET_PID_BIT_MASK 0x0040 ///< VDO enable PID interface +#define VDO_SET_BYPASS_BIT_MASK 0x0080 ///< VDO enable bypass bit mask +#define VDO_RESET_CONTROL_BIT_MASK 0x033F ///< VDO reset control bit mask -#define VDO_INIT_STATUS_BIT_MASK 0x0200 -#define VDO_ENABLE_PID_STATUS_BIT_MASK 0x0400 -#define VDO_ENABLE_BYPASS_STATUS_BIT_MASK 0x0800 +#define VDO_INIT_STATUS_BIT_MASK 0x0200 ///< VDO init status bit mask +#define VDO_ENABLE_PID_STATUS_BIT_MASK 0x0400 ///< VDO enable PID status bit mask +#define VDO_ENABLE_BYPASS_STATUS_BIT_MASK 0x0800 ///< VDO enable bypass status bit mask // Valve blood arterial defines -#define VBA_ENABLE_PID_INTERFACE 0x0001 -#define VBA_ENABLE_BYPASS_INTERFACE 0x0002 +#define VBA_SET_PID_BIT_MASK 0x0001 ///< VBA enable PID interface +#define VBA_SET_BYPASS_BIT_MASK 0x0002 ///< VBA enable bypass interface +#define VBA_RESET_CONTROL_BIT_MASK 0x03FC ///< VBA reset control bit mask -#define VBA_INIT_STATUS_BIT_MASK 0x0001 -#define VBA_ENABLE_PID_STATUS_BIT_MASK 0x0002 -#define VBA_ENABLE_BYPASS_STATUS_BIT_MASK 0x0004 +#define VBA_INIT_STATUS_BIT_MASK 0x0001 ///< VBA init status bit mask +#define VBA_ENABLE_PID_STATUS_BIT_MASK 0x0002 ///< VBA PID status bit mask +#define VBA_ENABLE_BYPASS_STATUS_BIT_MASK 0x0004 ///< VBA bypass status bit mask // Valve blood venous defines -#define VBV_ENABLE_PID_INTERFACE 0x0004 -#define VBV_ENABLE_BYPASS_INTERFACE 0x0008 +#define VBV_SET_PID_BIT_MASK 0x0004 ///< VBV enable PID interface bit mask +#define VBV_SET_BYPASS_BIT_MASK 0x0008 ///< VBV enable bypass interface bit mask +#define VBV_RESET_CONTROL_BIT_MASK 0x03F3 ///< VBV reset control bit mask -#define VBV_INIT_STATUS_BIT_MASK 0x0008 -#define VBV_ENABLE_PID_STATUS_BIT_MASK 0x0010 -#define VBV_ENABLE_BYPASS_STATUS_BIT_MASK 0x0020 +#define VBV_INIT_STATUS_BIT_MASK 0x0008 ///< VBV init status bit mask +#define VBV_ENABLE_PID_STATUS_BIT_MASK 0x0010 ///< VBV PID status bit mask +#define VBV_ENABLE_BYPASS_STATUS_BIT_MASK 0x0020 ///< VBV bypass status bit mask -#define ALL_VALVES_ENABLE_PID_INTERFACE 0x0055 +#define VALVES_DISABLE_BIT_MASK 0x0000 ///< Valves disable bit mask (command) +#define VALVES_DISABLED_BIT_MASK 0x0000 ///< Valves disabled bit mask (check) -#define ADC_TO_CURRENT_CONVERSION_CONSTANT 2048.0 +#define ENABLE_VALVE_CURRENT_RELAXATION 0x8000 ///< Enable valves current relaxation +#define DISABLE_VALVE_CURRENT_RELAXATION 0x7FFF ///< Disable valves current relaxation -#define INITIAL_EDGE_OFFSET_READ_COUNT 100 +#define ADC_TO_CURRENT_CONVERSION_CONSTANT 2048.0 ///< Valves ADC count to current conversion -#define INITIAL_ENERGIZED_EDGE_UPPER_RANGE 13000U -#define INITIAL_ENERGIZED_EDGE_LOWER_RANGE 9000U +#define INITIAL_EDGE_OFFSET_READ_COUNT 100U ///< Offset in counts from energized and de-energized edges -#define AIR_TRAP_VALVE_GPIO_PIN 0x12 +#define INITIAL_ENERGIZED_EDGE_UPPER_RANGE 13000U ///< Energized edge maximum count +#define INITIAL_ENERGIZED_EDGE_LOWER_RANGE 9000U ///< Energized edge minimum count -#define STEP_CHANGE_IN_COUNTS 1000 +#define AIR_TRAP_VALVE_GPIO_PIN 0x12 ///< Air trap valve GPIO pin number -#define MAX_DEVIATION_FROM_TARGET_IN_COUNTS 150 -#define MAX_ALLOWED_FAILED_HOMINGS 3U -#define HOMING_EDGE_DETECTION_TIME_INTERVAL ( MS_PER_SECOND / ( 2 * TASK_PRIORITY_INTERVAL ) ) ///< The time that the valve must be at the edge to be considered for edge detection -#define VALVES_CURRENT_THRESHOLD_AMPS 1U -#define OVER_CURRENT_COUNTER 100U -#define OUT_OF_RANGE_COUNTER 100U -#define VALVE_TRANSITION_TIMEOUT_MS 3000U //TODO experiment with this +#define STEP_CHANGE_IN_COUNTS 1000 ///< Step change in counts -#define NEXT_STEP_COMD_TIME_INTERVAL_COUNTER ( MS_PER_SECOND / ( 10 * TASK_PRIORITY_INTERVAL ) ) +#define MAX_DEVIATION_FROM_TARGET_IN_COUNTS 150 ///< Maximum deviation from target in counts +#define MAX_ALLOWED_FAILED_HOMINGS 3U ///< Maximum allowed failed homings +#define HOMING_EDGE_DETECTION_TIME_INTERVAL ( MS_PER_SECOND / ( 2 * TASK_PRIORITY_INTERVAL ) ) ///< The time that the valve must be at the edge to be considered for edge detection +#define VALVES_CURRENT_THRESHOLD_AMPS 1.0 ///< Valves current threshold +#define MAX_OVER_CURRENT_TIME_INTERVAL_COUNTER ( MS_PER_SECOND / ( TASK_PRIORITY_INTERVAL ) ) ///< Valves over current time interval counter +#define MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ( MS_PER_SECOND / ( TASK_PRIORITY_INTERVAL ) ) ///< Valves out of range time interval counter +#define VALVE_TRANSITION_TIMEOUT_MS 3000U ///< Valves transition time out in ms // TODO changed the interval count to every 10 calls in priority task which is 100 ms -#define VALVES_DATA_PUB_INTERVAL ( MS_PER_SECOND / ( 10 * TASK_PRIORITY_INTERVAL ) ) +#define VALVES_DATA_PUB_INTERVAL ( MS_PER_SECOND / ( 10 * TASK_PRIORITY_INTERVAL ) ) ///< Valve data publication time interval // ********** private data ********** /// Exec valve self test states typedef enum valves_Self_Test_States { - VALVE_SELF_TEST_ENABLE_VALVES = 0, - VALVE_SELF_TEST_CONFIRM_ENABLE, - VALVE_SELF_TEST_COMPLETE, - NUM_OF_VALVE_SELF_TEST_STATES + VALVE_SELF_TEST_ENABLE_VALVES = 0, ///< Valve self test enable valves + VALVE_SELF_TEST_CONFIRM_ENABLE, ///< Valve self test confirm enable + VALVE_SELF_TEST_COMPLETE, ///< Valve self test complete + NUM_OF_VALVE_SELF_TEST_STATES ///< Number of valve self test states } VALVE_SELF_TEST_STATE_T; /// Exec valve states typedef enum valve_Exec_States { - VALVE_STATE_WAIT_FOR_POST = 0, - VALVE_STATE_HOMING_NOT_STARTED, - VALVE_STATE_HOMING_FIND_ENERGIZED_EDGE, - VALVE_STATE_HOMING_FIND_DEENERGIZED_EDGE, - VALVE_STATE_IDLE, - VALVE_STATE_IN_TRANSITION, - NUM_OF_VALVE_STATES, + VALVE_STATE_WAIT_FOR_POST = 0, ///< Valve state wait for POST + VALVE_STATE_HOMING_NOT_STARTED, ///< Valve state homing not started + VALVE_STATE_HOMING_FIND_ENERGIZED_EDGE, ///< Valve state homing find energized edge + VALVE_STATE_HOMING_FIND_DEENERGIZED_EDGE, ///< Valve state homing find de-energized edge + VALVE_STATE_IDLE, ///< Valve state idle + VALVE_STATE_IN_TRANSITION, ///< Valve state in transition + NUM_OF_VALVE_STATES, ///< Number of valve exec states } VALVE_STATE_T; +/// Valve modes +typedef enum valve_modes +{ + VALVE_CONTROL_MODE_ENABLE_PID = 0, ///< Valve control mode enable PID + VALVE_CONTORL_MODE_ENABLE_BYPASS, ///< Valve control mode enable bypass + VALVE_CONTROL_MODE_DISABLE_ALL, ///< Valve control mode disable all modes + NUM_OF_VALVE_CONTROL_MODES, ///< Number of valve control modes +} VALVE_MODE_T; + +/// Valve control status +enum valve_control_status +{ + VALVE_CONTROL_STATUS_INITIALIZED = 0, ///< Valve control status initialized (PID control is initialized) + VALVE_CONTROL_STATUS_PID_ENABLED, ///< Valve control status PID enabled + VALVE_CONTROL_STATUS_BYPASS_ENABLED, ///< Valve control status bypass enabled + VALVE_CONTROL_STATUS_DISABLED, ///< Valve control status all disabled + NUM_OF_VALVE_CONTROL_STATUS ///< Number of valve control status +}; + #pragma pack(push, 1) /// Valve status structure typedef struct { - VALVE_POSITION_T commandedPosition; - VALVE_POSITION_T currentPosition; - S16 currentPositionInCounts; - S16 targetPositionInCounts; - BOOL hasTransitionBeenRequested; - VALVE_STATE_T execState; - U32 transitionStartTime; - S16 positions[ NUM_OF_VALVE_POSITIONS ]; - F32 valveCurrent; - U32 valveOverCurrentCounter; - U32 valvePositionOutOfRangeCounter; - U32 valveDataPublishCounter; - U32 valveRestCounter; //TODO REMOVE? + VALVE_POSITION_T commandedPosition; ///< Valve commanded position enum + VALVE_POSITION_T currentPosition; ///< Valve current position enum + S16 currentPositionInCounts; ///< Valve current position n counts + S16 targetPositionInCounts; ///< Valve target position in counts + BOOL hasTransitionBeenRequested; ///< Valve transition has been requested flag + VALVE_STATE_T execState; ///< Valve execution state + U32 transitionStartTime; ///< Valve transition start time + S16 positions[ NUM_OF_VALVE_POSITIONS ]; ///< Valve positions array (Pos A, Pos B, Pos C) + VALVE_MODE_T controlMode; ///< Valve control mode + F32 current; ///< Valve current + U32 overCurrentCounter; ///< Valve over current counter + U32 positionOutOfRangeCounter; ///< Valve position out of range counter + U32 dataPublishCounter; ///< Valve data publish counter + U32 restCounter; //TODO REMOVE? // Homing variables - U32 numberOfFailedHomings; - U32 homingEdgeDetectionCounter; - BOOL hasHomingBeenRequested; - BOOL hasValveBeenHomed; - BOOL hasHomingFailed; + U32 numberOfFailedHomings; ///< Valve number of failed homing + U32 homingEdgeDetectionCounter; ///< Valve homing edge detection counter + BOOL hasHomingBeenRequested; ///< Valve homing request flag + BOOL hasValveBeenHomed; ///< Valve homing completed flag + BOOL hasHomingFailed; ///< Valve homing failed flag } VALVE_STATUS_T; #pragma pack(pop) -static VALVE_SELF_TEST_STATE_T valveSelfTestState = VALVE_SELF_TEST_ENABLE_VALVES; -static SELF_TEST_STATUS_T valvesSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; +static VALVE_SELF_TEST_STATE_T valveSelfTestState = VALVE_SELF_TEST_ENABLE_VALVES; ///< Valves set test state +static SELF_TEST_STATUS_T valvesSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< Valves set test result -static VALVE_STATUS_T valvesStatus[ NUM_OF_VALVES ]; +static VALVE_STATUS_T valvesStatus[ NUM_OF_VALVES ]; ///< Valves status -static OVERRIDE_U32_T valvesDataPublishInterval = { VALVES_DATA_PUB_INTERVAL, VALVES_DATA_PUB_INTERVAL, 0, 0 }; +static OVERRIDE_U32_T valvesDataPublishInterval = { VALVES_DATA_PUB_INTERVAL, VALVES_DATA_PUB_INTERVAL, 0, 0 }; ///< Valves data publish interval -static OVERRIDE_U32_T valvesPositionOverride[ NUM_OF_VALVES ] = { VALVE_POSITION_C_CLOSE, VALVE_POSITION_C_CLOSE, 0, 0 }; +static OVERRIDE_U32_T valvesPositionOverride[ NUM_OF_VALVES ] = { VALVE_POSITION_C_CLOSE, VALVE_POSITION_C_CLOSE, 0, 0 }; ///< Valves position override +static const U16 valvesControlModesSetBits[ NUM_OF_VALVES ][ NUM_OF_VALVE_CONTROL_MODES ] = + { { VDI_SET_PID_BIT_MASK, VDI_SET_BYPASS_BIT_MASK, VALVES_DISABLE_BIT_MASK }, + { VDO_SET_PID_BIT_MASK, VDO_SET_BYPASS_BIT_MASK, VALVES_DISABLE_BIT_MASK }, + { VBA_SET_PID_BIT_MASK, VBA_SET_BYPASS_BIT_MASK, VALVES_DISABLE_BIT_MASK }, + { VBV_SET_PID_BIT_MASK, VBV_SET_BYPASS_BIT_MASK, VALVES_DISABLE_BIT_MASK } }; ///< Valves control mode set bits + +static const U16 valvesControlModesResetBits[ NUM_OF_VALVES ] = { VDI_RESET_CONTROL_BIT_MASK, VDO_RESET_CONTROL_BIT_MASK, + VBA_RESET_CONTROL_BIT_MASK, VBV_RESET_CONTROL_BIT_MASK }; ///< Valves control modes rest bits + +static const U16 valvesControlStatusBits[ NUM_OF_VALVES ][ NUM_OF_VALVE_CONTROL_STATUS ] = + { { VDI_INIT_STATUS_BIT_MASK, VDI_ENABLE_PID_STATUS_BIT_MASK, VDI_ENABLE_BYPASS_STATUS_BIT_MASK, VALVES_DISABLED_BIT_MASK }, + { VDO_INIT_STATUS_BIT_MASK, VDO_ENABLE_PID_STATUS_BIT_MASK, VDO_ENABLE_BYPASS_STATUS_BIT_MASK, VALVES_DISABLED_BIT_MASK }, + { VBA_INIT_STATUS_BIT_MASK, VBA_ENABLE_PID_STATUS_BIT_MASK, VBA_ENABLE_BYPASS_STATUS_BIT_MASK, VALVES_DISABLED_BIT_MASK }, + { VBV_INIT_STATUS_BIT_MASK, VBV_ENABLE_PID_STATUS_BIT_MASK, VBV_ENABLE_BYPASS_STATUS_BIT_MASK, VALVES_DISABLED_BIT_MASK } }; ///< Valves control status bits + +static U16 valvesControlSetBits = 0x0000; ///< Valves control set bit + // Self test function prototypes static VALVE_SELF_TEST_STATE_T handleValveSelfTestEnableValves( void ); static VALVE_SELF_TEST_STATE_T handleValveSelfTestConfirmEnable( void ); @@ -145,29 +188,35 @@ static VALVE_STATE_T handleValveStateInTransition( VALVE_T valve ); // Private function prototypes -static void setValveNextStep( VALVE_T valve ); +static void setValveControlMode( VALVE_T valve, VALVE_MODE_T mode ); static void execMonitorValves( void ); -static BOOL areValvesEnabled( void ); -static void setFPGAValue( VALVE_T valve, S16 position ); +static BOOL areValvesFunctional( void ); +static void setFPGAValue( VALVE_T valve, S16 position, BOOL enableCurrentRelaxation ); static void convertAndMonitorValvesCurrent( void ); static void getAndMonitorValvesCurrentPosition( void ); static DATA_GET_PROTOTYPE( U32, getPublishValvesDataInterval ); static void publishValvesData( VALVE_T valve ); +static void setValveNextStep( VALVE_T valve ); /*********************************************************************//** * @brief * The initValves function initializes the valves driver. * @details - * Inputs: valveSelfTestState, valvesSelfTestResult, valvesStatus + * Inputs: valveSelfTestState, valvesSelfTestResult, valvesStatus, + * valvesControlSetBits * Outputs: valveSelfTestState, valvesSelfTestResult, valvesStatus - * @return: none + * @return none *************************************************************************/ void initValves( void ) { VALVE_T valve; valveSelfTestState = VALVE_SELF_TEST_ENABLE_VALVES; valvesSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; + // Set the valves bit control to 0 + valvesControlSetBits = 0x0000; + setFPGAValvesControlMode( valvesControlSetBits ); + // Initialize some of the variables for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { @@ -181,7 +230,8 @@ * @details * Inputs: valvesStatus * Outputs: valvesStatus (The flag that sets the homing request) - * @return: none + * @param valve that is set to be homed + * @return none *************************************************************************/ void homeValve( VALVE_T valve ) { @@ -193,10 +243,10 @@ * The setValvePosition function sets the requested position of a valve. * @details * Inputs: valvesStatus - * Outputs: valvesStatus (commanded position) - * @param: valve : Enumeration of the valve - * @param: position : Enumeration of the commanded position - * @return: returns TRUE if the requested position was legal + * Outputs: valvesStatus + * @param valve that its position is set + * @param position that the valve is set + * @return returns TRUE if the requested position was legal *************************************************************************/ BOOL setValvePosition( VALVE_T valve, VALVE_POSITION_T position ) { @@ -208,6 +258,7 @@ { valvesStatus[ valve ].commandedPosition = position; valvesStatus[ valve ].hasTransitionBeenRequested = TRUE; + result = TRUE; } @@ -219,10 +270,9 @@ * The getValvePosition function returns the current position of a valve. * @details * Inputs: none - * Outputs: valvesStatus (current position) - * @param: valve : Enumeration of the valve - * @param: position : Enumeration of the commanded position - * @return: returns TRUE if the requested position was legal + * Outputs: valvesStatus + * @param valve that the position is requested + * @return returns the current position of the valve in enum *************************************************************************/ VALVE_POSITION_T getValvePosition( VALVE_T valve ) { @@ -257,7 +307,7 @@ * @details * Inputs: valveSelfTestState * Outputs: valveSelfTestState - * @return: valvesSelfTestResult : The status of the self test + * @return valvesSelfTestResult The status of the self test *************************************************************************/ SELF_TEST_STATUS_T execValvesSelfTest( void ) { @@ -287,9 +337,9 @@ * @brief * The execValves function executes the valves exec state machine. * @details - * Inputs: none - * Outputs: none (All the values are stored in the structure of each valve) - * @return: none + * Inputs: valvesStatus + * Outputs: valvesStatus + * @return none *************************************************************************/ void execValves( void ) { @@ -351,19 +401,26 @@ * @brief * The handleValveSelfTestEnableValves function starts the valves self test. * @details - * Inputs: valvesSelfTestResult - * Outputs: nvalvesSelfTestResult - * @return: Next state of the self test state machine + * Inputs: valvesSelfTestResult, valvesSelfTestResult + * Outputs: valvesSelfTestResult, valvesSelfTestResult + * @return next state of the self test state machine *************************************************************************/ static VALVE_SELF_TEST_STATE_T handleValveSelfTestEnableValves( void ) { - VALVE_SELF_TEST_STATE_T state = VALVE_SELF_TEST_CONFIRM_ENABLE; + VALVE_T valve; + VALVE_SELF_TEST_STATE_T state = VALVE_SELF_TEST_CONFIRM_ENABLE; valvesSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; - // Enable the PID controller of all of the valves - enableFPGAValvesPIDControl( ALL_VALVES_ENABLE_PID_INTERFACE ); + // Set all the valves to be in PID control mode + for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) + { + setValveControlMode( valve, VALVE_CONTROL_MODE_ENABLE_PID ); + // Set the control mode of each valve to be PID mode + valvesStatus[ valve ].controlMode = VALVE_CONTROL_MODE_ENABLE_PID; + } + return state; } @@ -374,14 +431,14 @@ * @details * Inputs: valvesSelfTestResult * Outputs: valvesSelfTestResult - * @return: Next state of the self test state machine + * @return next state of the self test state machine *************************************************************************/ static VALVE_SELF_TEST_STATE_T handleValveSelfTestConfirmEnable( void ) { VALVE_SELF_TEST_STATE_T state = VALVE_SELF_TEST_CONFIRM_ENABLE; // TODO do we need to wait for 50ms? - if ( areValvesEnabled() ) + if ( areValvesFunctional() ) { valvesSelfTestResult = SELF_TEST_STATUS_PASSED; state = VALVE_SELF_TEST_COMPLETE; @@ -397,12 +454,12 @@ /*********************************************************************//** * @brief - * The handleValveStateWaitForPost function handles the wait for POST \n - * state. + * The handleValveStateWaitForPost function handles the wait for POST state. * @details - * Inputs: valveSelfTestState, valveSelfTestState - * Outputs: valveSelfTestState (the next exec state of a valve) - * @return: none + * Inputs: valveSelfTestState + * Outputs: none + * @param valve that is waiting for POST to complete + * @return next state of exec state *************************************************************************/ static VALVE_STATE_T handleValveStateWaitForPost( VALVE_T valve ) { @@ -418,12 +475,13 @@ /*********************************************************************//** * @brief - * The handleValveStateHomingNotStarted function handles homing not started \n + * The handleValveStateHomingNotStarted function handles homing not started * state of the state machine. * @details - * Inputs: valvesStatus, valveSelfTestState + * Inputs: valvesStatus, valveSelfTestState, isDoorClosed * Outputs: valvesStatus - * @return: none + * @param valve that is set to be homed + * @return next state of the exec state machine *************************************************************************/ static VALVE_STATE_T handleValveStateHomingNotStarted( VALVE_T valve ) { @@ -443,7 +501,7 @@ valvesStatus[ valve ].targetPositionInCounts = valvesStatus[ valve ].currentPositionInCounts + STEP_CHANGE_IN_COUNTS; valvesStatus[ valve ].hasValveBeenHomed = FALSE; valvesStatus[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; - setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts ); + setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts, FALSE ); state = VALVE_STATE_HOMING_FIND_ENERGIZED_EDGE; } @@ -452,12 +510,13 @@ /*********************************************************************//** * @brief - * The handleValveStateHomingFindEnergizedEdge function handles find \n + * The handleValveStateHomingFindEnergizedEdge function handles find * energized state of the state machine. * @details - * Inputs: valvesStatus, valveSelfTestState + * Inputs: valvesStatus * Outputs: valvesStatus - * @return: none + * @param valve that its energized edge is found + * @return next state of the exec state machine *************************************************************************/ static VALVE_STATE_T handleValveStateHomingFindEnergizedEdge( VALVE_T valve ) { @@ -477,17 +536,17 @@ valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] = currentPosition; valvesStatus[ valve ].homingEdgeDetectionCounter = 0; valvesStatus[ valve ].targetPositionInCounts = currentPosition - STEP_CHANGE_IN_COUNTS; - setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts ); + setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts, FALSE ); state = VALVE_STATE_HOMING_FIND_DEENERGIZED_EDGE; } else if ( deltaPosition < MAX_DEVIATION_FROM_TARGET_IN_COUNTS ) { - if ( valvesStatus[ valve ].valveRestCounter >= 0 )//TODO add a #define for the rest time. Do we need the rest? + if ( valvesStatus[ valve ].restCounter >= 0 )//TODO add a #define for the rest time. Do we need the rest? { valvesStatus[ valve ].homingEdgeDetectionCounter = 0; valvesStatus[ valve ].targetPositionInCounts = currentPosition + STEP_CHANGE_IN_COUNTS; - setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts ); + setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts, FALSE ); } } @@ -496,12 +555,13 @@ /*********************************************************************//** * @brief - * The handleValveStateHomingFindDeenergizedEdge function handles find \n + * The handleValveStateHomingFindDeenergizedEdge function handles find * de-energized state of the state machine. * @details. - * Inputs: valvesStatus, valveSelfTestState + * Inputs: valvesStatus * Outputs: valvesStatus - * @return: none + * @param valve that its de-energized edge is found + * @return next state of the exec state machine *************************************************************************/ static VALVE_STATE_T handleValveStateHomingFindDeenergizedEdge( VALVE_T valve ) { @@ -517,7 +577,7 @@ valvesStatus[ valve ].homingEdgeDetectionCounter >= HOMING_EDGE_DETECTION_TIME_INTERVAL ) { S16 energizedEdge = valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ]; - S16 deltaEdges = energizedEdge - currentPosition; + S16 deltaEdges = energizedEdge - currentPosition; if ( deltaEdges <= INITIAL_ENERGIZED_EDGE_UPPER_RANGE && deltaEdges >= INITIAL_ENERGIZED_EDGE_LOWER_RANGE ) { @@ -526,8 +586,8 @@ valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] = positionB - INITIAL_EDGE_OFFSET_READ_COUNT; valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] = currentPosition + INITIAL_EDGE_OFFSET_READ_COUNT; // Position A is the average of the Position B that was read last time and position C that was the target of this state - valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ] = ( valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] + - abs(valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ]) ) / 2; + valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ] = ( valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] - + valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] ) / 2; // Set the current position to Position C and the commanded position to Position A // Request a transition valvesStatus[ valve ].hasValveBeenHomed = TRUE; @@ -557,11 +617,11 @@ } else if ( abs(deltaPosition) < MAX_DEVIATION_FROM_TARGET_IN_COUNTS ) { - if ( valvesStatus[ valve ].valveRestCounter >= 0 ) //TODO add a #define for the rest time. Do we need the rest? + if ( valvesStatus[ valve ].restCounter >= 0 ) //TODO add a #define for the rest time. Do we need the rest? { valvesStatus[ valve ].homingEdgeDetectionCounter = 0; valvesStatus[ valve ].targetPositionInCounts = currentPosition - STEP_CHANGE_IN_COUNTS; - setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts ); + setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts, FALSE ); } } @@ -570,12 +630,13 @@ /*********************************************************************//** * @brief - * The handleValveStateIdle function handles the idle state of the valves \n + * The handleValveStateIdle function handles the idle state of the valves * state machine. * @details - * Inputs: valveSelfTestState, valveSelfTestState - * Outputs: valveSelfTestState (the next exec state of a valve) - * @return: none + * Inputs: valvesStatus + * Outputs: valvesStatus + * @param valve that is in idle state + * @return next state of the exec state machine *************************************************************************/ static VALVE_STATE_T handleValveStateIdle( VALVE_T valve ) { @@ -603,13 +664,13 @@ /*********************************************************************//** * @brief - * The handleValveStateInTransition function handles the in transition \n + * The handleValveStateInTransition function handles the in transition * state of the state machine. * @details - * Inputs: valvesStatus (commanded position, current position, current position \n - * in counts, has transition been requested flag) + * Inputs: valvesStatus * Outputs: valvesStatus - * @return: none + * @param valve that is in position transition + * @return next state of the exec state machine *************************************************************************/ static VALVE_STATE_T handleValveStateInTransition( VALVE_T valve ) { @@ -629,6 +690,12 @@ valvesStatus[ valve ].currentPosition = commandedPositionEnum; // Set the transition request to false as it has been serviced valvesStatus[ valve ].hasTransitionBeenRequested = FALSE; + + if ( commandedPositionEnum == VALVE_POSITION_B_OPEN ) + { + setFPGAValue( valve, currentPosition, TRUE ); + } + // Go back to Idle state state = VALVE_STATE_IDLE; } @@ -640,7 +707,6 @@ // Go back to Idle state state = VALVE_STATE_IDLE; } - //TODO not sure if this works or not, Test this else if ( currentPosition - targetPosition < MAX_DEVIATION_FROM_TARGET_IN_COUNTS ) { setValveNextStep( valve ); @@ -651,17 +717,43 @@ /*********************************************************************//** * @brief - * The execMonitorValves function handles monitoring of the valves. The \n + * The setValveControlMode function sets the valves control mode. + * @details + * Inputs: valvesControlSetBits, valvesControlModesSetBits, + * valvesControlModesResetBits + * Outputs: valvesControlSetBits + * @param valve that its control mode is set + * @param mode the control mode that the valve will be set to + * @return none + *************************************************************************/ +static void setValveControlMode( VALVE_T valve, VALVE_MODE_T mode ) +{ + // Get the set and reset bits for the particular valve + U16 control = valvesControlModesSetBits[ valve ][ mode ]; + U16 reset = valvesControlModesResetBits[ valve ]; + + // Reset the control bits of the particular valve + valvesControlSetBits &= reset; + + // Set the new control mode of the valve to the variable + valvesControlSetBits |= control; + + setFPGAValvesControlMode( valvesControlSetBits ); +} + +/*********************************************************************//** + * @brief + * The execMonitorValves function handles monitoring of the valves. The * function calls other functions to monitor the values. * @details * Inputs: none * Outputs: none - * @return: none + * @return none *************************************************************************/ static void execMonitorValves( void ) { // Check if the valves are still enabled - areValvesEnabled(); + areValvesFunctional(); // Get the current position of the valves in counts and store them getAndMonitorValvesCurrentPosition(); @@ -673,76 +765,62 @@ /*********************************************************************//** * @brief - * The areValvesEnabled function checks the current valves status from FPGA \n - * to the enable bit mask of each valve. If any of the valves is not enabled \n + * The areValvesEnabled function checks the current valves status from FPGA + * to the enable bit mask of each valve. If any of the valves is not enabled * the function raises an alarm. * @details - * Inputs: none + * Inputs: valvesStatus, valvesControlStatusBits * Outputs: none - * @return: Returns TRUE if all the valves are enabled properly + * @return Returns TRUE if all the valves are enabled properly *************************************************************************/ -static BOOL areValvesEnabled( void ) +static BOOL areValvesFunctional( void ) { //TODO alarm for the valve status + VALVE_T valve; + VALVE_MODE_T mode; BOOL result = TRUE; - U16 status = getFPGAValvesStatus(); + /*VALVE_CONTROL_STATUS_INITIALIZED = 0, + VALVE_CONTROL_STATUS_PID_ENABLED, + VALVE_CONTROL_STATUS_BYPASS_ENABLED, + NUM_OF_VALVE_CONTROL_STATUS - // VDi status - if ( ! ( status & VDI_INIT_STATUS_BIT_MASK ) ) - { - result = FALSE; - } - if ( ! ( status & VDI_ENABLE_PID_STATUS_BIT_MASK ) ) - { - result = FALSE; - } - if ( status & VDI_ENABLE_BYPASS_STATUS_BIT_MASK ) - { - result = FALSE; - } + VALVE_CONTROL_MODE_ENABLE_PID = 0, + VALVE_CONTORL_MODE_ENABLE_BYPASS, + VALVE_CONTROL_MODE_DISABLE_ALL,*/ - // VDo status - if ( ! ( status & VDO_INIT_STATUS_BIT_MASK ) ) - { - result = FALSE; - } - if ( ! ( status & VDO_ENABLE_PID_STATUS_BIT_MASK ) ) - { - result = FALSE; - } - if ( status & VDO_ENABLE_BYPASS_STATUS_BIT_MASK ) - { - result = FALSE; - } + U16 status = getFPGAValvesStatus(); - // VBA status - if ( ! ( status & VBA_INIT_STATUS_BIT_MASK ) ) + for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { - result = FALSE; - } - if ( ! ( status & VBA_ENABLE_PID_STATUS_BIT_MASK ) ) - { - result = FALSE; - } - if ( status & VBA_ENABLE_BYPASS_STATUS_BIT_MASK ) - { - result = FALSE; - } + mode = valvesStatus[ valve ].controlMode; - // VBV status - if ( ! ( status & VBV_INIT_STATUS_BIT_MASK ) ) - { - result = FALSE; + if ( mode == VALVE_CONTROL_MODE_ENABLE_PID ) + { + if ( ! ( status & valvesControlStatusBits[ valve ][ VALVE_CONTROL_STATUS_INITIALIZED ] ) ) + { + result = FALSE; + } + if ( ! ( status & valvesControlStatusBits[ valve ][ VALVE_CONTROL_STATUS_PID_ENABLED ] ) ) + { + result = FALSE; + } + } + else if ( mode == VALVE_CONTORL_MODE_ENABLE_BYPASS ) + { + if ( ! ( status & valvesControlStatusBits[ valve ][ VALVE_CONTROL_STATUS_BYPASS_ENABLED ] ) ) + { + result = FALSE; + } + } + else if ( mode == VALVE_CONTROL_MODE_DISABLE_ALL ) + { + if ( ! ( status & valvesControlStatusBits[ valve ][ VALVE_CONTROL_STATUS_DISABLED ] ) ) + { + result = FALSE; + } + } } - if ( ! ( status & VBV_ENABLE_PID_STATUS_BIT_MASK ) ) - { - result = FALSE; - } - if ( status & VBV_ENABLE_BYPASS_STATUS_BIT_MASK ) - { - result = FALSE; - } return result; } @@ -753,12 +831,22 @@ * @details * Inputs: none * Outputs: none - * @param: valve : Enumeration of the valve - * @param: position : Position in counts - * @return: none + * @param valve that its FPGA set point is updated + * @param position that is set in counts + * @param enableCurrentRelaxation flag. Indicates whether current relaxation + * should be enabled for the valve + * @return none *************************************************************************/ -static void setFPGAValue( VALVE_T valve, S16 position ) +static void setFPGAValue( VALVE_T valve, S16 position, BOOL enableCurrentRelaxation ) { + // Always set the MSB of the S16 to 0 + position &= DISABLE_VALVE_CURRENT_RELAXATION; + + if ( enableCurrentRelaxation ) + { + position |= ENABLE_VALVE_CURRENT_RELAXATION; + } + switch ( valve ) { case VDI: @@ -789,47 +877,51 @@ /*********************************************************************//** * @brief - * The convertAndMonitorValvesCurrent function gets the current values \n - * in counts from FPGA and converts them to current. If any of the values \n - * is above the threshold, the function will raise an alarm. + * The convertAndMonitorValvesCurrent function gets the current values + * in counts from FPGA and converts them to current. If any of the values + * is above the threshold, the function raises an alarm. * @details * Inputs: valvesStatus * Outputs: valvesStatus - * @return: none + * @return none *************************************************************************/ static void convertAndMonitorValvesCurrent( void ) { VALVE_T valve; U16 currentInADC = 0; currentInADC = getFPGAValveDialyzerInletCurrentCounts(); - valvesStatus[ VDI ].valveCurrent = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; + valvesStatus[ VDI ].current = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; currentInADC = getFPGAValveDialyzerOutletCurrentCounts(); - valvesStatus[ VDO ].valveCurrent = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; + valvesStatus[ VDO ].current = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; - currentInADC = getFPGAValveBloodVenousCurrentCounts(); - valvesStatus[ VBA ].valveCurrent = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; - currentInADC = getFPGAValveBloodArterialCurrentCounts(); - valvesStatus[ VBV ].valveCurrent = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; + valvesStatus[ VBA ].current = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; + currentInADC = getFPGAValveBloodVenousCurrentCounts(); + valvesStatus[ VBV ].current = ( (F32)currentInADC / ADC_TO_CURRENT_CONVERSION_CONSTANT ) - 1; + // Check the current of all the valves for ( valve = VDI; valve < NUM_OF_VALVES; valve++) { + // Absolute value is used to cover both positive and negative values + F32 current = fabs( valvesStatus[ valve ].current ); + + if ( current > VALVES_CURRENT_THRESHOLD_AMPS ) + { + valvesStatus[ valve ].overCurrentCounter++; + } // Check if the current is over the threshold for the defined amount of time - // Absolute value was used to cover both positive and negative ranges - if ( abs(valvesStatus[ valve ].valveCurrent) > VALVES_CURRENT_THRESHOLD_AMPS && - ++valvesStatus[ valve ].valveOverCurrentCounter > OVER_CURRENT_COUNTER ) + if ( valvesStatus[ valve ].overCurrentCounter > MAX_OVER_CURRENT_TIME_INTERVAL_COUNTER ) { //TODO fault } // If the current is below the threshold again and the counter for the time is greater than - // zero, set the counter to zero. Absolute value is used here to cover both positive and negative ranges - else if ( abs(valvesStatus[ valve ].valveCurrent) < VALVES_CURRENT_THRESHOLD_AMPS && - valvesStatus[ valve ].valveOverCurrentCounter > 0 ) + else if ( current < VALVES_CURRENT_THRESHOLD_AMPS && + valvesStatus[ valve ].overCurrentCounter > 0 ) { - valvesStatus[ valve ].valveOverCurrentCounter = 0; + valvesStatus[ valve ].overCurrentCounter = 0; } } } @@ -844,7 +936,7 @@ * @details * Inputs: valvesStatus * Outputs: valvesStatus - * @return: none + * @return none *************************************************************************/ static void getAndMonitorValvesCurrentPosition( void ) { @@ -865,38 +957,38 @@ // Check the valve is in Idle state, otherwise the position should not be checked if ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) { - currentPostion = valvesStatus[ valve ].currentPositionInCounts; + currentPostion = valvesStatus[ valve ].currentPositionInCounts; commandedPositionEnum = valvesStatus[ valve ].commandedPosition; - commandedPoistion = valvesStatus[ valve ].positions[ commandedPositionEnum ]; + commandedPoistion = valvesStatus[ valve ].positions[ commandedPositionEnum ]; // Check if the current position has deviated from the position it is supposed to be in // for more than a certain amount of time. If it has, raise an alarm // Absolute value is used for comparison to cover +/- from the commanded position if ( abs( currentPostion - commandedPoistion ) > MAX_DEVIATION_FROM_TARGET_IN_COUNTS ) { - valvesStatus[ valve ].valvePositionOutOfRangeCounter++; + valvesStatus[ valve ].positionOutOfRangeCounter++; } - if ( valvesStatus[ valve ].valvePositionOutOfRangeCounter > OUT_OF_RANGE_COUNTER ) + if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) { //TODO fault } else { - valvesStatus[ valve ].valvePositionOutOfRangeCounter = 0; + valvesStatus[ valve ].positionOutOfRangeCounter = 0; } } } } /*********************************************************************//** * @brief - * The getPublishValvesDataInterval function gets the valves data publish \n + * The getPublishValvesDataInterval function gets the valves data publish * interval. * @details * Inputs: valvesDataPublishInterval * Outputs: none - * @return: The data publish time interval + * @return data publish time interval *************************************************************************/ U32 getPublishValvesDataInterval( void ) { @@ -912,50 +1004,63 @@ /*********************************************************************//** * @brief - * The publishValvesData function publishes the data of the valves at the \n + * The publishValvesData function publishes the data of the valves at the * specified time interval. * @details * Inputs: valvesStatus * Outputs: valvesStatus - * @return: none + * @param valve that its data is published + * @return none *************************************************************************/ static void publishValvesData( VALVE_T valve ) { // Check the counter - if ( ++valvesStatus[ valve ].valveDataPublishCounter > getPublishValvesDataInterval() ) + if ( ++valvesStatus[ valve ].dataPublishCounter > getPublishValvesDataInterval() ) { HD_VALVE_DATA_T valveData; valveData.valveID = (U32)valve; valveData.state = (U32)valvesStatus[ valve ].execState; valveData.currentPosID = (U32)valvesStatus[ valve ].currentPosition; valveData.currentPos = valvesStatus[ valve ].currentPositionInCounts; valveData.nextPos = valvesStatus[ valve ].targetPositionInCounts; - valveData.current = valvesStatus[ valve ].valveCurrent; + valveData.current = valvesStatus[ valve ].current; valveData.posC = valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ]; valveData.posA = valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ]; valveData.posB = valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ]; broadcastHDValves( &valveData ); - valvesStatus[ valve ].valveDataPublishCounter = 0; + valvesStatus[ valve ].dataPublishCounter = 0; } // TODO REMOVE Fast 10ms publish fastDataRemoveLater.currentPos = valvesStatus[ valve ].currentPositionInCounts; - fastDataRemoveLater.current = valvesStatus[ valve ].valveCurrent; + fastDataRemoveLater.current = valvesStatus[ valve ].current; fastDataRemoveLater.cmdPosition = valvesStatus[ valve ].targetPositionInCounts; broadcastFastTempHDValves(); // TODO REMOVE } +/*********************************************************************//** + * @brief + * The setValveNextStep function calculates the next step of a valve and + * calls another function to set the next step. + * @details + * Inputs: valvesStatus + * Outputs: valvesStatus + * @param valve that its next step is calculated and set + * @return none + *************************************************************************/ static void setValveNextStep( VALVE_T valve ) { S16 nextStep = 0; + S16 targetPosition = 0; VALVE_POSITION_T currentPositionEnum = valvesStatus[ valve ].currentPosition; VALVE_POSITION_T commandedPositionEnum = valvesStatus[ valve ].commandedPosition; - S16 currentPosition = valvesStatus[ valve ].currentPositionInCounts; + S16 currentPosition = valvesStatus[ valve ].currentPositionInCounts; S16 commandedPosition = valvesStatus[ valve ].positions[ commandedPositionEnum ]; + // If the next step is less than the specified step change, set that if ( abs( currentPosition - commandedPosition ) <= STEP_CHANGE_IN_COUNTS ) { nextStep = abs( currentPosition - commandedPosition ); @@ -964,7 +1069,6 @@ { nextStep = STEP_CHANGE_IN_COUNTS; } - // If the valve is currently in position A and its commanded position is position B, // add the defined number of steps for the next transition // If the valve is currently in position A and its commanded position is position C, @@ -974,24 +1078,48 @@ if ( commandedPositionEnum == VALVE_POSITION_B_OPEN ) { valvesStatus[ valve ].targetPositionInCounts = valvesStatus[ valve ].currentPositionInCounts + nextStep; + + if( nextStep < STEP_CHANGE_IN_COUNTS ) + { + targetPosition = valvesStatus[ valve ].targetPositionInCounts; + } + else + { + targetPosition = valvesStatus[ valve ].targetPositionInCounts; + } } if ( commandedPositionEnum == VALVE_POSITION_C_CLOSE ) { valvesStatus[ valve ].targetPositionInCounts = valvesStatus[ valve ].currentPositionInCounts - nextStep; + + targetPosition = valvesStatus[ valve ].targetPositionInCounts; } } // If the valve is currently in position B, subtract the defined number of steps for the next transition else if ( currentPositionEnum == VALVE_POSITION_B_OPEN ) { valvesStatus[ valve ].targetPositionInCounts = valvesStatus[ valve ].currentPositionInCounts - nextStep; + + targetPosition = valvesStatus[ valve ].targetPositionInCounts; } // If the valve is currently in position C, add the defined number of steps for the next transition else if ( currentPositionEnum == VALVE_POSITION_C_CLOSE ) { valvesStatus[ valve ].targetPositionInCounts = valvesStatus[ valve ].currentPositionInCounts + nextStep; + + if ( nextStep < STEP_CHANGE_IN_COUNTS && commandedPositionEnum == VALVE_POSITION_B_OPEN ) + { + targetPosition = valvesStatus[ valve ].targetPositionInCounts; + } + else + { + targetPosition = valvesStatus[ valve ].targetPositionInCounts; + } } - setFPGAValue( valve, valvesStatus[ valve ].targetPositionInCounts ); + // Call the function to send the set point to FPGA. Current relaxation is not + // enabled here, so it is always false + setFPGAValue( valve, targetPosition, FALSE ); } /************************************************************************* @@ -1000,12 +1128,12 @@ /*********************************************************************//** * @brief - * The testSetValvesDataPublishInterval function overrides the valves \n - * data publish interval. + * The testSetValvesDataPublishInterval function overrides the valves data + * publish interval. * @details * Inputs: valvesDataPublishInterval * Outputs: valvesDataPublishInterval - * @param: value : override valve data publish interval with (in ms) + * @param value which is override value for the valve data publish interval * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetValvesDataPublishInterval( U32 value ) @@ -1024,10 +1152,9 @@ return result; } - /*********************************************************************//** * @brief - * The testResetValvesDataPublishInterval function resets the override \n + * The testResetValvesDataPublishInterval function resets the override * of the valves publish interval. * @details * Inputs: valvesDataPublishInterval @@ -1048,16 +1175,14 @@ return result; } - /*********************************************************************//** * @brief - * The testSetValvesPositionOverride function overrides the valves \n - * position. + * The testSetValvesPositionOverride function overrides the valves position. * @details * Inputs: valvesPositionOverride, valvesStatus - * Outputs: valvesPositionOverride, valvesStatus - * @param valve The valve ID - * @param position The position the valve has to transition to + * Outputs: valvesPositionOverride + * @param valve to override its position + * @param position of the valve that will be overridden * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetValvesPositionOverride( U32 valve, U32 position ) @@ -1082,12 +1207,12 @@ /*********************************************************************//** * @brief - * The testResetValvesDataPublishInterval function resets the override \n + * The testResetValvesDataPublishInterval function resets the override * of the valves publish interval. * @details * Inputs: valvesDataPublishInterval * Outputs: valvesDataPublishInterval - * @param valve The valve ID + * @param valve that its data publish will be overridden * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetValvesPositionOverride( U32 valve ) @@ -1105,4 +1230,14 @@ return result; } +BOOL testSetValveControlMode( U32 valve, U32 mode ) +{ + +} + +BOOL testResetValveControlMode( U32 valve ) +{ + +} + /**@}*/