Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -ra5560a2917aa62bcafd8e6a81041ace723237109 -r37294a71c0b3e3ca67ccb10b85536d124d3ef028 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision a5560a2917aa62bcafd8e6a81041ace723237109) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 37294a71c0b3e3ca67ccb10b85536d124d3ef028) @@ -33,11 +33,11 @@ #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 10 ///< Minimum encoder position delta from target position to end transition state. -#define VALVE_HOME_MIN_POS_CHG 10 ///< Minimum encoder position change to indicate a home operation is still moving toward edge. -#define VALVE_HOME_BACK_OFF_EDGE 10 ///< Encoder counts to back off of detected edge position. +#define VALVE_TRANSITION_MIN_TGT_DELTA 3 ///< 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_ALLOWED_FAILED_VALVE_HOMINGS 3U ///< Maximum allowed failed valve home attempts -#define MAX_HOME_FULL_TRAVEL_DIFF 100U ///< Maximum allowed difference in full travel encoder counts between expected and measured during home operation. +#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 3000U ///< Valves transition time out in ms #define VALVE_FORCE_HOME TRUE ///< Force valve to home even if already homed @@ -254,7 +254,7 @@ currentValveStates[ valve ].currentEncPosition = getValveEncoderPosition( valve ); // execute valve state machine - switch( currentValveStates[ valve ].controlState ) + switch ( currentValveStates[ valve ].controlState ) { case VALVE_STATE_WAIT_FOR_POST: currentValveStates[ valve ].controlState = handleValvesWait4PostState( valve ); @@ -305,7 +305,7 @@ if ( valve < NUM_OF_VALVES ) { -// if ( getCurrentOperationMode() != MODE_INIT ) + if ( getCurrentOperationMode() != MODE_INIT ) { nextState = VALVE_STATE_HOMING_NOT_STARTED; } @@ -336,11 +336,11 @@ { if ( TRUE == currentValveStates[ valve ].hasHomingBeenRequested ) { - U16 mag = ( 2 * ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS ); + U16 mag = ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS; // command valve to move to energized edge (end of travel) currentValveStates[ valve ].homingEdgeDetectionCounter = 0; - currentValveStates[ valve ].targetEncPosition = ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS; + currentValveStates[ valve ].targetEncPosition = mag; currentValveStates[ valve ].hasValveBeenHomed = FALSE; currentValveStates[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; setValveCmdChangePosition( valve, (U16)mag, MOTOR_DIR_FORWARD ); @@ -376,14 +376,14 @@ // have we found foward edge of travel? if ( fabs( curPos - currentValveStates[ valve ].priorEncPosition ) < VALVE_HOME_MIN_POS_CHG ) { - U16 mag = ( 2 * ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS ); + U16 mag = ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS + VALVE_HOME_MIN_POS_CHG; // Record edge position currentValveStates[ valve ].positionsABC[ VALVE_POSITION_B_OPEN ] = curPos - VALVE_HOME_BACK_OFF_EDGE; // command valve to move to de-energized edge (end of travel) currentValveStates[ valve ].homingEdgeDetectionCounter = 0; currentValveStates[ valve ].targetEncPosition = 0; - setValveCmdChangePosition( valve, (U16)mag, MOTOR_DIR_REVERSE ); + setValveCmdChangePosition( valve, mag, MOTOR_DIR_REVERSE ); nextState = VALVE_STATE_HOMING_FIND_DEENERGIZED_EDGE; } } @@ -424,7 +424,7 @@ if ( expDelta <= MAX_HOME_FULL_TRAVEL_DIFF ) { // Record edge position - currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] = curPos + VALVE_HOME_BACK_OFF_EDGE; + currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] = posC; // calculate and record middle position currentValveStates[ valve ].positionsABC[ VALVE_POSITION_A_INSERT_EJECT ] = currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] + \ ( ( currentValveStates[ valve ].positionsABC[ VALVE_POSITION_B_OPEN ] - currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ] ) / 2 ); Index: firmware/App/Drivers/RotaryValve.c =================================================================== diff -u -r51f42cd88bd9c50ed9096a2d1d8ff859a95aff95 -r37294a71c0b3e3ca67ccb10b85536d124d3ef028 --- firmware/App/Drivers/RotaryValve.c (.../RotaryValve.c) (revision 51f42cd88bd9c50ed9096a2d1d8ff859a95aff95) +++ firmware/App/Drivers/RotaryValve.c (.../RotaryValve.c) (revision 37294a71c0b3e3ca67ccb10b85536d124d3ef028) @@ -27,14 +27,11 @@ // ********** private definitions ********** -#define VALVE_ENC_COUNT_2_MICRO_STEP_CONVERSION 6.25F ///< 6.25 microsteps per encoder count. +#define VALVE_MOTOR_DRIVER_FAULT_BIT_MASK 0x10 ///< Bit mask for valve motor driver fault. +#define VALVE_MOTOR_STALL_BIT_MASK 0x40 ///< Bit mask for valve stall. -#define VALVE_MOTOR_DRIVER_FAULT_BIT_MASK 0x1 ///< Bit mask for valve motor driver fault. -#define VALVE_DIRECTION_FAULT_BIT_MASK 0x2 ///< Bit mask for valve direction fault. -#define VALVE_INCORRECT_ENCODER_STATUS_BIT_MASK 0x4 ///< Bit mask for valve incorrect encoder sensor fault. - /// Bit mask for all (OR'd) valve faults. -#define VALVE_GEN_FAULT_BIT_MASK ( VALVE_MOTOR_DRIVER_FAULT_BIT_MASK | VALVE_DIRECTION_FAULT_BIT_MASK | VALVE_INCORRECT_ENCODER_STATUS_BIT_MASK ) +#define VALVE_GEN_FAULT_BIT_MASK ( VALVE_MOTOR_DRIVER_FAULT_BIT_MASK | VALVE_MOTOR_STALL_BIT_MASK ) #pragma pack(push, 1) /// Payload record structure for rotary valve set position request @@ -49,7 +46,7 @@ static U08 valveControl[ NUM_OF_VALVES ]; ///< Current control bits for each valve. static OVERRIDE_U32_T valveStatus[ NUM_OF_VALVES ]; ///< Current status bits for each valve. -static S16 commandValvePosChange[ NUM_OF_VALVES ]; ///< Current commanded valve position changes. Negative indicates CCW direction. +static S16 commandValvePos[ NUM_OF_VALVES ]; ///< Current commanded valve positions. static OVERRIDE_S32_T currentValveEncPosition[ NUM_OF_VALVES ]; ///< Current encoder valve positions (overrideable). Negative indicates CCW direction. // ********** private function prototypes ********** @@ -70,8 +67,7 @@ for ( i = FIRST_VALVE; i < NUM_OF_VALVES; i++ ) { - valveControl[ i ] = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; // enable valves, configure for 1/32 step control - commandValvePosChange[ i ] = 0; + valveControl[ i ] = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; // enable valves, configure for 1/8 step control currentValveEncPosition[ i ].data = 0; currentValveEncPosition[ i ].ovData = 0; currentValveEncPosition[ i ].ovInitData = 0; @@ -81,6 +77,8 @@ valveStatus[ i ].ovInitData = 0; valveStatus[ i ].override = OVERRIDE_RESET; } + commandValvePos[ H1_VALV ] = getH1EncoderPosition(); + commandValvePos[ H19_VALV ] = getH19EncoderPosition(); // set valve control bits once at startup setH1Control( valveControl[ H1_VALV ] ); @@ -102,17 +100,14 @@ void readValves( void ) { U32 i; - S16 cmdPos[ NUM_OF_VALVES ]; // Get latest valve status and positions from FPGA - cmdPos[ H19_VALV ] = getH19CmdPosition(); currentValveEncPosition[ H19_VALV ].data = (S32)getValveEncoderPosition( H19_VALV ); valveStatus[ H19_VALV ].data = getH19Status(); - cmdPos[ H1_VALV ] = getH1CmdPosition(); currentValveEncPosition[ H1_VALV ].data = (S32)getValveEncoderPosition( H1_VALV ); valveStatus[ H1_VALV ].data = getH1Status(); - // TODO check commanded position vs. commanded position read back from FPGA - alarm different for some persistent period of time + // TODO - compare commanded vs. read position // Check valves status for faults for ( i = FIRST_VALVE; i < NUM_OF_VALVES; i++ ) @@ -133,7 +128,7 @@ * @details \b Message \Sent: MSG_ID_TD_EVENT for TD_EVENT_VALVE_POS_CHANGE * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if invalid valve given. * @details \b Inputs: none - * @details \b Outputs: commandValvePosChange[] + * @details \b Outputs: commandValvePos[] * @param valve Valve to set new commanded change in position for * @param mag Magnitude of position change for valve (in encoder counts) * @param dir Direction to move valve @@ -143,29 +138,21 @@ { if ( valve < NUM_OF_VALVES ) { - S16 chg = (S16)mag * ( MOTOR_DIR_REVERSE == dir ? -1 : 1 ); - U08 ctrl; - F32 temp; + U16 mag8 = ( ( mag % 8 ) < 4 ? ( mag >> 3 ) << 3 : ( ( mag >> 3 ) << 3 ) + 1 ); // round to multiple of 8 to maximize holding torque + S16 chgSteps = (S16)mag * ( MOTOR_DIR_REVERSE == dir ? -1 : 1 ); // convert to signed change in position - negative value indicates reverse direction // log event showing valve position change commanded - SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_VALVE_POS_CHANGE, (U32)commandValvePosChange[ valve ], (U32)chg ); - // convert magnitude of change from encoder counts to microsteps - temp = (F32)chg * VALVE_ENC_COUNT_2_MICRO_STEP_CONVERSION; - chg = (S16)((S32)((temp) + FLOAT_TO_INT_ROUNDUP_OFFSET)); - mag = (S16)(abs(chg)); - // give FPGA valve change command - commandValvePosChange[ valve ] = chg; + SEND_EVENT_WITH_2_U32_DATA( TD_EVENT_VALVE_POS_CHANGE, (U32)commandValvePos[ valve ], (U32)chgSteps ); + // calculate and record new commanded valve position + commandValvePos[ valve ] = getValveEncoderPosition( valve ) + chgSteps; + // give FPGA new commanded valve position if ( H1_VALV == valve ) { - ctrl = getH1Control(); - setH1Control( ( ctrl | FPGA_PINCH_VALVES_NEW_POS_CMD ) ); - setH1Position( mag ); + setH1Position( commandValvePos[ valve ] ); } else { - ctrl = getH19Control(); - setH19Control( ( ctrl | FPGA_PINCH_VALVES_NEW_POS_CMD ) ); - setH19Position( mag ); + setH19Position( commandValvePos[ valve ] ); } } else @@ -176,35 +163,6 @@ /*********************************************************************//** * @brief - * The getValveCmdTravel function gets the most recent commanded travel (in - * encoder counts) for a given valve. - * @note A negative return value indicates travel in the reverse (CCW) direction. - * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if invalid valve given. - * @details \b Inputs: commandValvePosChange[] - * @details \b Outputs: none - * @param valve ID of valve to get commanded position for - * @return Commanded position change (in encoder counts) for the given valve - *************************************************************************/ -S16 getValveCmdTravel( VALVE_T valve ) -{ - S16 result = 0; - - if ( valve < NUM_OF_VALVES ) - { - F32 temp = (F32)commandValvePosChange[ valve ] / VALVE_ENC_COUNT_2_MICRO_STEP_CONVERSION; // convert magnitude of change from microsteps to encoder counts - - result = (S16)((S32)((temp) + FLOAT_TO_INT_ROUNDUP_OFFSET)); - } - else - { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_VALVES_INVALID_VALVE2, (U32)valve ) - } - - return result; -} - -/*********************************************************************//** - * @brief * The getValveEncoderPosition function gets the current actual position * (in encoder counts) for a given valve. * @note There are 1024 encoder counts per revolution. @@ -324,7 +282,7 @@ { VALVE_ROTARY_SET_CMD_PAYLOAD_T payload; - memcpy( &payload, message->payload, sizeof(VALVE_ROTARY_SET_CMD_PAYLOAD_T) ); + memcpy( &payload, message->payload, sizeof( VALVE_ROTARY_SET_CMD_PAYLOAD_T ) ); if ( payload.valve < NUM_OF_VALVES ) { MOTOR_DIR_T dir = MOTOR_DIR_FORWARD; Index: firmware/App/Drivers/RotaryValve.h =================================================================== diff -u -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 -r37294a71c0b3e3ca67ccb10b85536d124d3ef028 --- firmware/App/Drivers/RotaryValve.h (.../RotaryValve.h) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) +++ firmware/App/Drivers/RotaryValve.h (.../RotaryValve.h) (revision 37294a71c0b3e3ca67ccb10b85536d124d3ef028) @@ -33,10 +33,10 @@ // ********** public definitions ********** -#define ROTARY_VALVE_MICROSTEP_FRACTION 32 ///< Rotary valve motors configured for 1/32 step microstepping. +#define ROTARY_VALVE_MICROSTEP_FRACTION 8 ///< Rotary valve motors configured for 1/8 step microstepping. #define ROTARY_VALVE_GEAR_RATIO 3.7F ///< Rotary valve motor gear ratio is 3.7:1. #define ROTARY_VALVE_FULL_SWING_TRAVEL_DEG 200.0F ///< Rotary valve swing arm travel range is appx. 200 degrees. -#define ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS 2048 ///< Rotary valve swing arm travel range is appx. 2048 enconder counts. +#define ROTARY_VALVE_FULL_SWING_TRAVEL_COUNTS 256 ///< Rotary valve swing arm travel range is appx. 256 enconder counts. /// rotary pinch valve names typedef enum valveNames @@ -52,7 +52,6 @@ void initRotaryValvesDriver( void ); void readValves( void ); void setValveCmdChangePosition( VALVE_T valve, U16 mag, MOTOR_DIR_T dir ); -S16 getValveCmdTravel( VALVE_T valve ); S16 getValveEncoderPosition( VALVE_T valve ); BOOL testValveEncoderPositionOverride( MESSAGE_T *message ); Index: firmware/App/Services/FpgaTD.c =================================================================== diff -u -rae3240cfb3237c01472168fee0bfc6beb34e0ed9 -r37294a71c0b3e3ca67ccb10b85536d124d3ef028 --- firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision ae3240cfb3237c01472168fee0bfc6beb34e0ed9) +++ firmware/App/Services/FpgaTD.c (.../FpgaTD.c) (revision 37294a71c0b3e3ca67ccb10b85536d124d3ef028) @@ -110,20 +110,18 @@ S16 h2Temperature; ///< Reg 274. H2 raw temperature data. U08 h2ReadCount; ///< Reg 276. H2 read count. U08 h2ErrorCount; ///< Reg 277. H2 error count. - S16 H1CmdPosition; ///< Reg 278. H1 commanded position (200 steps/rev). - S16 H1EncPosition; ///< Reg 280. H1 encoder position (1024 counts/rev). - U08 H1Status; ///< Reg 282. H1 status. - U08 reserved1; ///< Reg 283. Reserved and available for future use. - U08 reserved2; ///< Reg 284. Reserved and available for future use. - U08 reserved3; ///< Reg 285. Reserved and available for future use. - S32 reserved4; ///< Reg 286. Reserved and available for future use. - S16 H4Period; ///< Reg 290. H4 measured period (10 uSec). - S16 H4Torque; ///< Reg 292. H4 measured torque. - S16 H4SpeedFromHall; ///< Reg 294. H4 measured speed from hall sensor(s). - S16 H19CmdPosition; ///< Reg 296. H19 commanded position (200 steps/rev). - S16 H19EncPosition; ///< Reg 298. H19 encoder position (1024 counts/rev). - U08 H19Status; ///< Reg 300. H19 status. - U08 H4Status; ///< Reg 301. H4 status. + U16 reserved1; ///< Reg 278. Reserved and available for future use. + S16 h1EncPosition; ///< Reg 280. H1 encoder position (1000 steps/rev). + U16 h1Status; ///< Reg 282. H1 status. + U32 reserved2; ///< Reg 284. Reserved and available for future use. + U16 reserved3; ///< Reg 288. Reserved and available for future use. + S16 h4Period; ///< Reg 290. H4 measured period (10 uSec). + S16 h4Torque; ///< Reg 292. H4 measured torque. + S16 h4SpeedFromHall; ///< Reg 294. H4 measured speed from hall sensor(s). + U16 h19Status; ///< Reg 296. H19 status. + S16 h19EncPosition; ///< Reg 298. H19 encoder position (1000 steps/rev). + U08 reserved4; ///< Reg 300. H19 status. + U08 h4Status; ///< Reg 301. H4 status. U16 GPIOReg; ///< Reg 302. GPIO register. U08 HEPStatus; ///< Reg 304. HEP status register. U08 HEPAdcReadCount; ///< Reg 305. HEP ADC read counter. @@ -147,8 +145,8 @@ S16 ACPower2Voltage; ///< Reg 338. AC power voltage - 2. S16 ACPower3Current; ///< Reg 340. AC power current - 3. S16 ACPower3Voltage; ///< Reg 342. AC power voltage - 3. - S16 H4RotorHallCount; ///< Reg 344. H4 rotor count from hall sensor. - U08 H6RotorStatus; ///< Reg 346. H6 rotor status. + S16 h4RotorHallCount; ///< Reg 344. H4 rotor count from hall sensor. + U08 h6RotorStatus; ///< Reg 346. H6 rotor status. U08 reserved5; ///< U16 h12Speed; ///< Reg 348. H12 speed (in RPM). } FPGA_SENSORS_T; @@ -165,14 +163,14 @@ U08 h12Control; ///< Reg 14. H12 Air pump control register. U08 h5Control; ///< Reg 15. H5 ejector stepper motor control register. U16 NotUsed; ///< Reg 16. Reserved. - U16 H4SetSpeed; ///< Reg 18. H4 Blood pump speed set register (RPM). - U08 H4Control; ///< Reg 20. H4 Blood pump control register. - U08 H19Control; ///< Reg 21. H19 control register. - S16 H19Position; ///< Reg 22. H19 position set register (200 steps/rev). + U16 h4SetSpeed; ///< Reg 18. H4 Blood pump speed set register (RPM). + U08 h4Control; ///< Reg 20. H4 Blood pump control register. + U08 h19Control; ///< Reg 21. H19 control register. + S16 h19Position; ///< Reg 22. H19 position set register (200 steps/rev). U16 NotUsed2; ///< Reg 24. Reserved. - S16 H1Position; ///< Reg 26. H1 position set register (200 steps/rev). + S16 h1Position; ///< Reg 26. H1 position set register (200 steps/rev). U16 NotUsed3; ///< Reg 28. Reserved. - U08 H1Control; ///< Reg 30. H1 control register. + U08 h1Control; ///< Reg 30. H1 control register. U08 h1h19ValveEncoderControl; ///< Reg 31. H1/H19 valve encoder control register. U08 alarmControl; ///< Reg 32. Alarm audio control register. U08 syrPumpControl; ///< Reg 33. Syringe pump control register. @@ -217,8 +215,8 @@ fpgaActuatorSetPoints.alarmControl = (U08)MIN_ALARM_VOLUME_ATTENUATION << 2; // Start alarm audio volume at maximum // Set H1 and H19 to default configuration + disabled so they do not run immediately on power up - fpgaActuatorSetPoints.H1Control = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; - fpgaActuatorSetPoints.H19Control = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; + fpgaActuatorSetPoints.h1Control = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; + fpgaActuatorSetPoints.h19Control = FPGA_PINCH_VALVES_1_8_STEP | FPGA_PINCH_VALVES_DISABLE | FPGA_PINCH_VALVES_NOT_RESET | FPGA_PINCH_VALVES_NOT_SLEEP; // initialize FPGA comm failures windowed timer count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES, MAX_FPGA_COMM_FAILURES_WINDOW_MS); @@ -456,11 +454,11 @@ { if ( TRUE == enable ) { - fpgaActuatorSetPoints.H4Control |= FPGA_H4_ENABLE_BIT_MASK; + fpgaActuatorSetPoints.h4Control |= FPGA_H4_ENABLE_BIT_MASK; } else { - fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_ENABLE_BIT_MASK); + fpgaActuatorSetPoints.h4Control &= ~((U08)FPGA_H4_ENABLE_BIT_MASK); } } @@ -479,11 +477,11 @@ { if ( MOTOR_DIR_REVERSE == dir ) { - fpgaActuatorSetPoints.H4Control |= FPGA_H4_DIRECTION_REV_BIT_MASK; + fpgaActuatorSetPoints.h4Control |= FPGA_H4_DIRECTION_REV_BIT_MASK; } else { - fpgaActuatorSetPoints.H4Control &= ~((U08)FPGA_H4_DIRECTION_REV_BIT_MASK); + fpgaActuatorSetPoints.h4Control &= ~((U08)FPGA_H4_DIRECTION_REV_BIT_MASK); } } @@ -492,26 +490,26 @@ * The setH4SetSpeed function sets the fpga blood pump set speed * to the given speed (0..3000 RPM). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h4SetSpeed * @param rpm the set point for the H4 pump speed (in RPM). * @return none *************************************************************************/ void setH4SetSpeed( U16 rpm ) { - fpgaActuatorSetPoints.H4SetSpeed = rpm; + fpgaActuatorSetPoints.h4SetSpeed = rpm; } /*********************************************************************//** * @brief * The getH4Period function gets the latest blood pump period (in 10uSec) * from the FPGA. - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h4Period * @details \b Outputs: none * @return Latest blood pump period. *************************************************************************/ U16 getH4Period( void ) { - return fpgaSensorReadings.H4Period; + return fpgaSensorReadings.h4Period; } /*********************************************************************//** @@ -535,13 +533,13 @@ * Bit 0: 0=Magnet is detected (used for homing in forward direction) * Bit 1: 0=Reverse pump direction detected, 1=Forward pump direction detected * Bit 2..7: Not used. - * @details \b Inputs: fpgaSensorReadings.H6RotorStatus + * @details \b Inputs: fpgaSensorReadings.h6RotorStatus * @details \b Outputs: none * @return Latest blood pump hall sensor status bits. *************************************************************************/ U08 getH6RotorStatus( void ) { - return fpgaSensorReadings.H6RotorStatus; + return fpgaSensorReadings.h6RotorStatus; } /*********************************************************************//** @@ -550,13 +548,13 @@ * hall sensor count. Count is number of ms between rotor revolutions. * If direction is forward, the count will be positive. If direction is * reverse, the count will be negative. - * @details \b Inputs: fpgaSensorReadings.H4RotorHallCount + * @details \b Inputs: fpgaSensorReadings.h4RotorHallCount * @details \b Outputs: none * @return Latest blood pump hall sensor count reading. *************************************************************************/ S16 getH4RotorCount( void ) { - return fpgaSensorReadings.H4RotorHallCount; + return fpgaSensorReadings.h4RotorHallCount; } /*********************************************************************//** @@ -886,39 +884,39 @@ * 0=sleep mode * Reserved: bit 7 * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h19Control * @param controlBits The control bits to apply to the venous pinch valve. * @return none *************************************************************************/ void setH19Control( U08 controlBits ) { - fpgaActuatorSetPoints.H19Control = controlBits; + fpgaActuatorSetPoints.h19Control = controlBits; } /*********************************************************************//** * @brief * The getH19Control function gets the current control bits for the H19 valve. - * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints.h19Control * @details \b Outputs: none * @return fpgaActuatorSetPoints.H19Control *************************************************************************/ U08 getH19Control( void ) { - return fpgaActuatorSetPoints.H19Control; + return fpgaActuatorSetPoints.h19Control; } /*********************************************************************//** * @brief * The setH19Position function sets the travel from current position for the * H19 valve in counts (or microcounts if microstepping is set in control register). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h19Position * @param setPoint The target encoder position of the H19 valve in counts * @return none *************************************************************************/ void setH19Position( S16 setPoint ) { - fpgaActuatorSetPoints.H19Position = setPoint; + fpgaActuatorSetPoints.h19Position = setPoint; } /*********************************************************************//** @@ -933,34 +931,19 @@ *************************************************************************/ S16 getH19EncoderPosition( void ) { - return fpgaSensorReadings.H19EncPosition; + return fpgaSensorReadings.h19EncPosition; } /*********************************************************************//** * @brief - * The getH19CmdPosition function returns the current amount of travel - * from the pre-command position in steps (or microsteps if microstepping is - * set in control register) for H19 valve. - * @note There are 200 steps per revolution - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return The commanded encoder position of H19 valve - *************************************************************************/ -S16 getH19CmdPosition( void ) -{ - return fpgaSensorReadings.H19CmdPosition; -} - -/*********************************************************************//** - * @brief * The getH19Status function reads the status of the venous pinch valve. - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h19Status * @details \b Outputs: none * @return Latest status of the venous pinch valve *************************************************************************/ U16 getH19Status( void ) { - return fpgaSensorReadings.H19Status; + return fpgaSensorReadings.h19Status; } /*********************************************************************//** @@ -975,9 +958,9 @@ * 5=1/2 step (modified) * 6=1/4 step * 7=1/8 step - * Direction: bit 3 - * 0=forward - * 1=reverse + * Encoder Reset: bit 3 + * 0=not reset + * 1=reset * Enable: bit 4 (active low) * 0=enabled * 1=disabled @@ -987,80 +970,65 @@ * 0=sleep mode * Reserved: bit 7 * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h1Control * @param controlBits The control bits to apply to the arterial pinch valve. * @return none *************************************************************************/ void setH1Control( U08 controlBits ) { - fpgaActuatorSetPoints.H1Control = controlBits; + fpgaActuatorSetPoints.h1Control = controlBits; } /*********************************************************************//** * @brief * The getH1Control function gets the current control bits for the H1 valve. - * @details \b Inputs: fpgaActuatorSetPoints + * @details \b Inputs: fpgaActuatorSetPoints.h1Control * @details \b Outputs: none - * @return fpgaActuatorSetPoints.H1Control + * @return fpgaActuatorSetPoints.h1Control *************************************************************************/ U08 getH1Control( void ) { - return fpgaActuatorSetPoints.H1Control; + return fpgaActuatorSetPoints.h1Control; } /*********************************************************************//** * @brief * The setH1Position function sets the travel from current position for the * H1 valve in counts (or microcounts if microstepping is set in control register). * @details \b Inputs: none - * @details \b Outputs: fpgaActuatorSetPoints + * @details \b Outputs: fpgaActuatorSetPoints.h1Position * @param setPoint The target encoder position of the H1 valve in counts * @return none *************************************************************************/ void setH1Position( S16 setPoint ) { - fpgaActuatorSetPoints.H1Position = setPoint; + fpgaActuatorSetPoints.h1Position = setPoint; } /*********************************************************************//** * @brief * The getH1EncoderPosition function reads the current encoder position of the * H1 valve in counts. * @note There are 1024 encoder counts per revolution - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h1EncPosition * @details \b Outputs: none * @return The latest encoder position of H1 valve *************************************************************************/ S16 getH1EncoderPosition( void ) { - return fpgaSensorReadings.H1EncPosition; + return fpgaSensorReadings.h1EncPosition; } /*********************************************************************//** * @brief - * The getH1CmdPosition function returns returns the current amount of travel - * from the pre-command position in steps (or microsteps if microstepping is - * set in control register) for H1 valve. - * @note There are 200 steps per revolution - * @details \b Inputs: fpgaSensorReadings - * @details \b Outputs: none - * @return The commanded encoder position of H1 valve - *************************************************************************/ -S16 getH1CmdPosition( void ) -{ - return fpgaSensorReadings.H1CmdPosition; -} - -/*********************************************************************//** - * @brief * The getH1Status function reads the status of the arterial pinch valve. - * @details \b Inputs: fpgaSensorReadings + * @details \b Inputs: fpgaSensorReadings.h1Status * @details \b Outputs: none * @return Latest status of the arterial pinch valve *************************************************************************/ U16 getH1Status( void ) { - return fpgaSensorReadings.H1Status; + return fpgaSensorReadings.h1Status; } /*********************************************************************//** Index: firmware/App/Services/FpgaTD.h =================================================================== diff -u -rae3240cfb3237c01472168fee0bfc6beb34e0ed9 -r37294a71c0b3e3ca67ccb10b85536d124d3ef028 --- firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision ae3240cfb3237c01472168fee0bfc6beb34e0ed9) +++ firmware/App/Services/FpgaTD.h (.../FpgaTD.h) (revision 37294a71c0b3e3ca67ccb10b85536d124d3ef028) @@ -107,14 +107,12 @@ U08 getH19Control( void ); void setH19Position( S16 setPoint ); S16 getH19EncoderPosition( void ); -S16 getH19CmdPosition( void ); U16 getH19Status( void ); void setH1Control( U08 controlBits ); U08 getH1Control( void ); void setH1Position( S16 setPoint ); S16 getH1EncoderPosition( void ); -S16 getH1CmdPosition( void ); U16 getH1Status( void ); U16 getFPGABoardTemperature( void );