Index: firmware/App/Drivers/EjectorMotor.c =================================================================== diff -u -r82bb2222f791a434d22921e2fe4f5edd7e74776d -rb824ef4b479578c5aa702abd9147aef505a6fb04 --- firmware/App/Drivers/EjectorMotor.c (.../EjectorMotor.c) (revision 82bb2222f791a434d22921e2fe4f5edd7e74776d) +++ firmware/App/Drivers/EjectorMotor.c (.../EjectorMotor.c) (revision b824ef4b479578c5aa702abd9147aef505a6fb04) @@ -7,11 +7,11 @@ * * @file EjectorMotor.c * -* @author (last) Sean -* @date (last) 13-May-2025 +* @author (last) Sean Nash +* @date (last) 29-Jul-2025 * -* @author (original) Sean -* @date (original) 13-May-2025 +* @author (original) Sean Nash +* @date (original) 15-May-2025 * ***************************************************************************/ @@ -47,6 +47,7 @@ #define EJECTOR_MOTOR_CONTROL_REVERSE_DIR 0x00 ///< Ejector motor control register bit for direction (1=fwd, 0=rev). #define EJECTOR_MOTOR_CONTROL_FORWARD_DIR 0x08 ///< Ejector motor control register bit mask for forward direction. #define EJECTOR_MOTOR_CONTROL_32TH_STEP 0x03 ///< Ejector motor control register bits for 1/32 micro-stepping mode. +#define EJECTOR_MOTOR_CONTROL_FULL_STEP 0x00 ///< Ejector motor control register bits for full stepping mode. /// Control bits to run ejector motor in reverse direction static const U08 EJECTOR_MOTOR_CONTROL_RUN_REVERSE = EJECTOR_MOTOR_CONTROL_SLEEP_OFF | @@ -61,6 +62,12 @@ EJECTOR_MOTOR_CONTROL_FORWARD_DIR | EJECTOR_MOTOR_CONTROL_32TH_STEP; +/// Control bits to disable ejector motor +static const U08 EJECTOR_MOTOR_CONTROL_DISABLED = EJECTOR_MOTOR_CONTROL_SLEEP_OFF | + EJECTOR_MOTOR_CONTROL_NOT_RESET | + EJECTOR_MOTOR_CONTROL_FORWARD_DIR | + EJECTOR_MOTOR_CONTROL_32TH_STEP; + /// Payload record structure for ejector motor set request typedef struct { @@ -95,11 +102,28 @@ ejectorMotorRampUpInProgress = FALSE; setH5StepToggleTime( ejectorMotorSetToggleTime ); - setH5ControlFlags( EJECTOR_MOTOR_CONTROL_RUN_FORWARD ); + setH5ControlFlags( EJECTOR_MOTOR_CONTROL_DISABLED ); } /*********************************************************************//** * @brief + * The disableEjectorMotor function sets the ejector motor to be disabled + * when not in motion to prevent over-heating. + * @note Ejector motor must be off first. + * @details \b Inputs: ejectorMotorSetToggleTime + * @details \b Outputs: none + * @return none + *************************************************************************/ +void disableEjectorMotor( void ) +{ + if ( ejectorMotorSetToggleTime != EJECTOR_MOTOR_MICROSTEP_TOGGLE_TIME_FOR_STOP ) + { + setH5ControlFlags( EJECTOR_MOTOR_CONTROL_DISABLED ); + } +} + +/*********************************************************************//** + * @brief * The setEjectorMotorSpeed function sets the ejector motor to the given * set speed and direction. * @details \b Inputs: currentEjectorMotorSetSpeed