Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r6d2e13dfca9285909eddd958ca82bf3da1157412 -r2c9f7442169ce34dd4a2fffe91e293efab255826 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 6d2e13dfca9285909eddd958ca82bf3da1157412) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 2c9f7442169ce34dd4a2fffe91e293efab255826) @@ -37,18 +37,8 @@ #define VALVES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Valves data publish interval. #define DATA_PUBLISH_COUNTER_START_COUNT 13 ///< Valves data publish start counter. #define VALVE_TRANSITION_MIN_TGT_DELTA 50 ///< Minimum encoder position delta from target position to end transition state. -//#define VALVE_HOME_MIN_POS_CHG 3 ///< Minimum encoder position change to indicate a home operation is still moving toward edge. -//#define VALVE_HOME_BACK_OFF_EDGE 3 ///< Encoder counts to back off of detected edge position. -//#define MAX_HOME_FULL_TRAVEL_DIFF 10U ///< Maximum allowed difference in full travel encoder counts between expected and measured during home operation. #define VALVE_TRANSITION_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< Valves transition time out in ms. #define VALVE_HOMING_TIMEOUT_MS ( 15 * MS_PER_SECOND ) ///< Valves homing time out in ms. -//#define HOMING_EDGE_DETECTION_TIMEOUT_MS ( 0.5 * MS_PER_SECOND ) ///< Valves homing edge detection timeout in milliseconds. -//#define VALVE_FORCE_HOME TRUE ///< Force valve to home even if already homed. -//#define ZERO_ENC_DEBOUNCE_THRESHOLD_CNT 5 ///< Valves zero encoder debounce threshold count. -//#define ZERO_ENC_DEBOUNCE_TIMEOUT_MS ( 0.25 * MS_PER_SECOND ) ///< Valves zero encoder debounce timeout in milliseconds. -//#define VALVE_OFFEST_FROM_EDG_CNT 296 ///< Valves offset from the edge. -//#define POS_C_FROM_ZERO_CNT VALVE_OFFEST_FROM_EDG_CNT ///< Position C from zero position in counts. -//#define POS_D_PARTIAL_CLOSE_FROM_ZERO_CNT ( POS_C_FROM_ZERO_CNT + 32 ) ///< Position D partial close from zero position in counts. /// Valve status structure typedef struct Index: firmware/App/Drivers/PinchValve.c =================================================================== diff -u -r6d2e13dfca9285909eddd958ca82bf3da1157412 -r2c9f7442169ce34dd4a2fffe91e293efab255826 --- firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 6d2e13dfca9285909eddd958ca82bf3da1157412) +++ firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision 2c9f7442169ce34dd4a2fffe91e293efab255826) @@ -249,7 +249,7 @@ // ********** private function prototypes ********** // Low level command state machine handlers -static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( VALVE_T valve ); +static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( void ); static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdSetCmdState( VALVE_T valve ); static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdXmitCmdState( VALVE_T valve ); static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdWaitDoneState( VALVE_T valve ); @@ -368,7 +368,7 @@ * The execPinchValveCommand function executes the low level FPGA command * state machine. * @details \b Inputs: commandState[] -* @details \b Outputs: commandState[] +* @details \b Outputs: commandFailed [] * @return current state (sub-mode) *************************************************************************/ void execPinchValveCommand( void ) @@ -380,7 +380,7 @@ switch ( commandState[ valve ] ) { case PINCH_VALVE_CMD_IDLE_STATE: - commandState[ valve ] = handlePinchValveCmdIdleState( valve ); + commandState[ valve ] = handlePinchValveCmdIdleState(); break; case PINCH_VALVE_CMD_SET_CMD_STATE: @@ -419,7 +419,7 @@ * The execPinchValveFunction function executes the pinch valve * homing and position command sequence state machine. * @details \b Inputs: functionState[] -* @details \b Outputs: functionState[] +* @details \b Outputs: commandFailed[] * @return current state (sub-mode) *************************************************************************/ void execPinchValveFunction( void ) @@ -459,10 +459,8 @@ * @param valve H1_VALV or H19_VALV. * @return next Pinch Valve command state machine. *************************************************************************/ -static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( VALVE_T valve ) +static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdIdleState( void ) { - ( void )valve; - return PINCH_VALVE_CMD_IDLE_STATE; } @@ -567,7 +565,7 @@ *************************************************************************/ static PINCH_VALVE_CMD_STATE_T handlePinchValveCmdReadWordsState( VALVE_T valve ) { - PINCH_VALVE_CMD_STATE_T nextState; + PINCH_VALVE_CMD_STATE_T nextState = PINCH_VALVE_CMD_READ_WORDS_STATE; if ( ( TRUE == didPinchValveErrorCountChange( valve ) ) || ( TRUE == isPinchValveControllerFaultActive( valve ) ) || @@ -632,7 +630,7 @@ * h19HomingCommands[], positionCommands[] * @details \b Outputs: pendingValvePositionRequest[], homingInProgress[], positionInProgress[], * activeCommandArray[], activeCommandCount[], activeCommandIndex[], -* commandFailed[], positionCommands[] +* commandFailed[], positionCommands[], pendingValveHomeRequest[] * @param valve H1_VALV or H19_VALV. * @return next Pinch Valve function state machine *************************************************************************/ @@ -692,7 +690,7 @@ * in the active homing or position sequence. * @details \b Inputs: valve, activeCommandArray[], activeCommandCount[], * activeCommandIndex[], commandState[] -* @details \b Outputs: commandFailed[], activeCommand[], commandState[] +* @details \b Outputs: commandFailed[], activeCommand[] * @param valve H1_VALV or H19_VALV. * @return next Pinch Valve function state machine. *************************************************************************/ @@ -770,9 +768,9 @@ * @brief * The homePinchValve function requests the homing command sequence for the * selected pinch valve. -* @details \b Inputs: valve, pendingValveHomeRequest[], +* @details \b Inputs: none +* @details \b Outputs: commandFailed[], pendingValveHomeRequest[], * pendingValvePositionRequest[] -* @details \b Outputs: commandFailed[], enableResetValue[] * @param valve H1_VALV or H19_VALV. * @return TRUE if the homing request is accepted, FALSE otherwise. *************************************************************************/ @@ -796,8 +794,7 @@ * @brief * The setPinchValvePosition function requests movement to the selected * stored pinch valve position. -* @details \b Inputs: valve, position, pendingValveHomeRequest[], -* pendingValvePositionRequest[], valvePositions[] +* @details \b Inputs: none * @details \b Outputs: pendingValvePosition[], * pendingValvePositionRequest[], pendingValveHomeRequest[], * commandFailed[] @@ -846,8 +843,8 @@ * @brief * The setPinchValveEnableReset function sets the enable and reset * register for the selected valve. -* @details \b Inputs: valve, enable, reset -* @details \b Outputs: enableResetValue[] +* @details \b Inputs: none +* @details \b Outputs: none * @param valve H1_VALV or H19_VALV. * @param enable TRUE to enable the pinch valve controller. * @param reset TRUE to assert the pinch valve controller reset. @@ -918,7 +915,7 @@ * @brief * The isPinchValveHomed function checks whether homed valve positions have * been stored for the selected pinch valve. -* @details \b Inputs: valve, valvePositions[] +* @details \b Inputs: valvePositions[] * @details \b Outputs: none * @param valve H1_VALV or H19_VALV. * @return TRUE if the selected valve has a stored Position A, FALSE otherwise. @@ -939,7 +936,7 @@ * @brief * The getPinchValveStoredPosition function returns the stored encoder count * for the selected pinch valve position. -* @details \b Inputs: valve, position, valvePositions[] +* @details \b Inputs: position, valvePositions[] * @details \b Outputs: none * @param valve H1_VALV or H19_VALV. * @param position Stored valve position to read. @@ -987,7 +984,7 @@ * @details \b Outputs: activeCommand[], commandOutputWord1[], * commandOutputWord2[], commandOutputWord3[], commandSpiStatus[], * commandErrorCount[], commandFailed[], commandState[] -* @param valve H1_VALV or H19_VALV.. +* @param valve H1_VALV or H19_VALV. * @param command Pinch valve command to execute * @return TRUE if the command is accepted, FALSE otherwise.. *************************************************************************/ @@ -1021,8 +1018,9 @@ * @brief * The writePinchValveCommandRegisters function writes the active command * header, input words and FPGA command byte. -* @details \b Inputs: valve, activeCommand[] -* @details \b Outputs: fpgaCommandValue[] +* @details \b Inputs: fpgaCommandValue[] +* @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the command registers are written, FALSE otherwise. *************************************************************************/ static BOOL writePinchValveCommandRegisters( VALVE_T valve ) @@ -1299,13 +1297,14 @@ * The isPinchValveCommandDone function checks the SPI command done bit. * @details \b Inputs: commandSpiStatus[] * @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the command done bit is set, FALSE otherwise. *************************************************************************/ static BOOL isPinchValveCommandDone( VALVE_T valve ) { BOOL result; - result = ( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_DONE_BIT_MASK ) != 0 ); + result = ( 0 != ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_DONE_BIT_MASK ) ) ? TRUE : FALSE; return result; } @@ -1316,13 +1315,15 @@ * status bit. * @details \b Inputs: commandSpiStatus[] * @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the controller fault bit is set, FALSE otherwise *************************************************************************/ static BOOL isPinchValveControllerFaultActive( VALVE_T valve ) { BOOL result; - result = ( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_CONTROLLER_FAULT_BIT_MASK ) != 0 ); + result = ( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_CONTROLLER_FAULT_BIT_MASK ) != 0 ) + ? TRUE : FALSE; return result; } @@ -1333,13 +1334,14 @@ * error count changed during the active transaction. * @details \b Inputs: commandErrorCount[] * @details \b Outputs: none +* @param valve H1_VALV or H19_VALV. * @return TRUE if the error count changed, FALSE otherwise. *************************************************************************/ static BOOL didPinchValveErrorCountChange( VALVE_T valve ) { BOOL result; - result = ( commandErrorCount[ valve ] != errorCountAtCommandStart[ valve ] ); + result = ( commandErrorCount[ valve ] != errorCountAtCommandStart[ valve ] ) ? TRUE : FALSE; return result; } @@ -1430,7 +1432,9 @@ } else { - receivedCount = (U08)( ( commandSpiStatus[ valve ] & PINCH_VALVE_SPI_RX_COUNT_MASK ) >> PINCH_VALVE_SPI_RX_COUNT_SHIFT ); + receivedCount = (U08)( ( commandSpiStatus[ valve ] & + PINCH_VALVE_SPI_RX_COUNT_MASK ) >> + PINCH_VALVE_SPI_RX_COUNT_SHIFT ); if ( receivedCount == activeCommand[ valve ].outputWordCount ) { @@ -1459,7 +1463,7 @@ { BOOL result; - result = ( ( H1_VALV == valve ) || ( H19_VALV == valve ) ); + result = ( ( H1_VALV == valve ) || ( H19_VALV == valve ) ) ? TRUE : FALSE; return result; } @@ -1545,7 +1549,7 @@ * words into a signed 32 bit value. * @details \b Inputs: valve, commandOutputWord1[], commandOutputWord2[] * @details \b Outputs: none -* * @param valve H1_VALV or H19_VALV. +* @param valve H1_VALV or H19_VALV. * @return Signed 32 bit command output value. *************************************************************************/ static S32 getSigned32OutputValue( VALVE_T valve ) @@ -1650,7 +1654,7 @@ { BOOL result; - result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_COMPLETE_MASK ) ); + result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_COMPLETE_MASK ) ) ? TRUE : FALSE; return result; } @@ -1668,7 +1672,7 @@ { BOOL result; - result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_ERROR_MASK ) ); + result = ( 0 != ( status & PINCH_VALVE_EVENT_MOTION_ERROR_MASK ) ) ? TRUE : FALSE; return result; } Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rf3404e7ea0bd86fcea261ce5f95e352ee493a49a -r2c9f7442169ce34dd4a2fffe91e293efab255826 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision f3404e7ea0bd86fcea261ce5f95e352ee493a49a) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 2c9f7442169ce34dd4a2fffe91e293efab255826) @@ -158,8 +158,8 @@ * The handleStandbyModeStartState function handles the standby start state. * This state waits for the door to be closed and then initiates homing of * pumps and valves and transitions to the wait for treatment state. - * @details \b Inputs: - * @details \b Outputs: + * @details \b Inputs: homingInitiated + * @details \b Outputs: homingInitiated * @return next state of the standby mode state machine *************************************************************************/ static TD_STANDBY_STATE_T handleStandbyModeStartState( void ) @@ -189,53 +189,6 @@ return state; } - -//static TD_STANDBY_STATE_T handleStandbyModeStartState( void ) -//{ -// TD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; -// -// // If we haven't already initiated homing of actuators, initiate now -// if ( homingInitiated != TRUE ) -// { -// VALVE_T valve; -// -// // Home pumps and valves -// for ( valve = FIRST_VALVE; valve < NUM_OF_VALVES; ++valve ) -// { -// homeValve( valve, FALSE, TRUE ); -// } -//// homeBloodPump(); -//// homeDialInPump(); -//// homeDialOutPump(); -//// retractSyringePump(); -// -// homingInitiated = TRUE; -// } -//// else -//// { -//// // If homing has been initiated, wait for syringe pump to home and the verify force sensor calibration -////#ifndef _RELEASE_ -//// if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP ) ) -//// { -//// state = STANDBY_WAIT_FOR_TREATMENT_STATE; // Go to wait for treatment state after above check -//// } -//// else -////#endif -//// { -//// if ( ( TRUE == isSyringePumpHome() ) && ( TRUE == isSyringePumpStopped() ) ) -//// { -//// syringePumpVerifyForceSensorDACCalibration(); -//// homingInitiated = FALSE; // reset for next time -//// doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode -//// state = STANDBY_WAIT_FOR_TREATMENT_STATE; // Go to wait for treatment state after above check -//// } -//// } -//// } -//// } -// -// return state; -//} - /*********************************************************************//** * @brief * The handleStandbyModeWaitForTreatmentState function handles wait for Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -r0e809b89fe509c2968c3445898466dd8dd9411a9 -r2c9f7442169ce34dd4a2fffe91e293efab255826 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 0e809b89fe509c2968c3445898466dd8dd9411a9) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 2c9f7442169ce34dd4a2fffe91e293efab255826) @@ -1719,8 +1719,8 @@ /*********************************************************************//** * @brief * The setH1InputWord1 function sets H1 Magellan input word 1. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param inputWord Input word 1 value. * @return none *************************************************************************/ @@ -1732,8 +1732,8 @@ /*********************************************************************//** * @brief * The setH1InputWord2 function sets H1 Magellan input word 2.hh - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param inputWord Input word 2 value. * @return none *************************************************************************/ @@ -1745,8 +1745,8 @@ /*********************************************************************//** * @brief * The setH1InputWord3 function sets H1 Magellan input word 3. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param inputWord Input word 3 value. * @return none *************************************************************************/ @@ -1758,8 +1758,8 @@ /*********************************************************************//** * @brief * The setH1FPGACmd function sets the H1 Magellan FPGA command register. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param cmd FPGA command value. * @return none *************************************************************************/ @@ -1771,8 +1771,8 @@ /*********************************************************************//** * @brief * The setH1EnableReset function sets the H1 Magellan enable/reset register. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param value Enable/reset register value. * @return none *************************************************************************/ @@ -1784,8 +1784,8 @@ /*********************************************************************//** * @brief * The setH19CmdHeader function sets the H19 Magellan command header. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param cmdHeader H19 Magellan command header. * @return none *************************************************************************/ @@ -1797,8 +1797,8 @@ /*********************************************************************//** * @brief * The setH19InputWord1 function sets H19 Magellan input word 1. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param inputWord Input word 1 value. * @return none *************************************************************************/ @@ -1810,8 +1810,8 @@ /*********************************************************************//** * @brief * The setH19InputWord2 function sets H19 Magellan input word 2. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param inputWord Input word 2 value. * @return none *************************************************************************/ @@ -1823,8 +1823,8 @@ /*********************************************************************//** * @brief * The setH19InputWord3 function sets H19 Magellan input word 3. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param inputWord Input word 3 value. * @return none *************************************************************************/ @@ -1836,8 +1836,8 @@ /*********************************************************************//** * @brief * The setH19FPGACmd function sets the H19 Magellan FPGA command register. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param cmd FPGA command value. * @return none *************************************************************************/ @@ -1849,8 +1849,8 @@ /*********************************************************************//** * @brief * The setH19EnableReset function sets the H19 Magellan enable/reset register. - * @details \b Inputs: fpgaActuatorSetPoints - * @details \b Outputs: none + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints * @param value Enable/reset register value. * @return none *************************************************************************/ @@ -2005,10 +2005,10 @@ /*********************************************************************//** * @brief - * The geth1ReadEnableRest function reads the H19 status. + * The geth1ReadEnableRest function reads the H1 status. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none - * @return H19 motor status. + * @return H1 motor status. *************************************************************************/ U08 geth1ReadEnableRest( void ) {