Index: firmware/App/Drivers/EjectorMotor.c =================================================================== diff -u -r959f16a2530e68b517cbb5c12c430d5aef4c5f9d -r82bb2222f791a434d22921e2fe4f5edd7e74776d --- firmware/App/Drivers/EjectorMotor.c (.../EjectorMotor.c) (revision 959f16a2530e68b517cbb5c12c430d5aef4c5f9d) +++ firmware/App/Drivers/EjectorMotor.c (.../EjectorMotor.c) (revision 82bb2222f791a434d22921e2fe4f5edd7e74776d) @@ -44,8 +44,8 @@ #define EJECTOR_MOTOR_CONTROL_NOT_RESET 0x20 ///< Ejector motor control register bit for resetting stepper motor (active low). #define EJECTOR_MOTOR_CONTROL_ENABLE 0x00 ///< Ejector motor control register bit mask for enable. #define EJECTOR_MOTOR_CONTROL_DISABLE 0x10 ///< Ejector motor control register bit for enable (active low). -#define EJECTOR_MOTOR_CONTROL_REVERSE_DIR 0x08 ///< Ejector motor control register bit for direction (0=fwd, 1=rev). -#define EJECTOR_MOTOR_CONTROL_FORWARD_DIR 0x00 ///< Ejector motor control register bit mask for forward direction. +#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. /// Control bits to run ejector motor in reverse direction @@ -113,7 +113,7 @@ BOOL result = FALSE; // if starting motor, motor must be stopped first - if ( ( fabs(rpm) > 0.0F ) && ( currentEjectorMotorSetSpeed < NEARLY_ZERO ) ) + if ( ( fabs(rpm) > 0.0F ) && ( fabs( currentEjectorMotorSetSpeed ) < NEARLY_ZERO ) ) { U32 stepTime = calcEjectorStepToggleTimeFromSetSpeed( rpm ); U08 ctrl = EJECTOR_MOTOR_CONTROL_RUN_FORWARD; @@ -132,7 +132,7 @@ result = TRUE; } // if stopping motor, motor must be running first - else if ( ( fabs(rpm) < NEARLY_ZERO ) && ( currentEjectorMotorSetSpeed > 0.0F ) ) + else if ( ( fabs(rpm) < NEARLY_ZERO ) && ( fabs( currentEjectorMotorSetSpeed ) > 0.0F ) ) { ejectorMotorRampUpInProgress = FALSE; ejectorMotorSetToggleTime = EJECTOR_MOTOR_MICROSTEP_TOGGLE_TIME_FOR_STOP;