Fix init of last_direction_bits (#13067)

This commit is contained in:
Mark Zachmann 2019-02-03 02:29:00 -05:00 committed by Scott Lahteine
parent 4fa1c52688
commit 4d1093b386
2 changed files with 24 additions and 5 deletions

View file

@ -534,3 +534,16 @@
#define IS_CARTESIAN !IS_KINEMATIC #define IS_CARTESIAN !IS_KINEMATIC
#define HAS_ACTION_COMMANDS (defined(ACTION_ON_KILL) || defined(ACTION_ON_PAUSE) || defined(ACTION_ON_PAUSED) || defined(ACTION_ON_RESUME) || defined(ACTION_ON_RESUMED) || defined(ACTION_ON_CANCEL) || defined(G29_ACTION_ON_RECOVER) || defined(G29_ACTION_ON_FAILURE) || defined(ACTION_ON_FILAMENT_RUNOUT)) #define HAS_ACTION_COMMANDS (defined(ACTION_ON_KILL) || defined(ACTION_ON_PAUSE) || defined(ACTION_ON_PAUSED) || defined(ACTION_ON_RESUME) || defined(ACTION_ON_RESUMED) || defined(ACTION_ON_CANCEL) || defined(G29_ACTION_ON_RECOVER) || defined(G29_ACTION_ON_FAILURE) || defined(ACTION_ON_FILAMENT_RUNOUT))
#ifndef INVERT_X_DIR
#define INVERT_X_DIR false
#endif
#ifndef INVERT_Y_DIR
#define INVERT_Y_DIR false
#endif
#ifndef INVERT_Z_DIR
#define INVERT_Z_DIR false
#endif
#ifndef INVERT_E_DIR
#define INVERT_E_DIR false
#endif

View file

@ -129,10 +129,10 @@ Stepper stepper; // Singleton
// private: // private:
block_t* Stepper::current_block = NULL; // A pointer to the block currently being traced block_t* Stepper::current_block; // (= NULL) A pointer to the block currently being traced
uint8_t Stepper::last_direction_bits = 0, uint8_t Stepper::last_direction_bits, // = 0
Stepper::axis_did_move; Stepper::axis_did_move; // = 0
bool Stepper::abort_current_block; bool Stepper::abort_current_block;
@ -2143,14 +2143,20 @@ void Stepper::init() {
E_AXIS_INIT(5); E_AXIS_INIT(5);
#endif #endif
set_directions();
// Init Stepper ISR to 122 Hz for quick starting // Init Stepper ISR to 122 Hz for quick starting
HAL_timer_start(STEP_TIMER_NUM, 122); HAL_timer_start(STEP_TIMER_NUM, 122);
ENABLE_STEPPER_DRIVER_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT();
sei(); sei();
// Init direction bits for first moves
last_direction_bits = 0
| (INVERT_X_DIR ? _BV(X_AXIS) : 0)
| (INVERT_Y_DIR ? _BV(Y_AXIS) : 0)
| (INVERT_Z_DIR ? _BV(Z_AXIS) : 0);
set_directions();
} }
/** /**