|
@@ -91,7 +91,7 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even
|
91
|
91
|
|
92
|
92
|
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
|
93
|
93
|
|
94
|
|
- unsigned char Stepper::old_OCR0A;
|
|
94
|
+ unsigned char Stepper::old_OCR0A = 0;
|
95
|
95
|
volatile unsigned char Stepper::eISR_Rate = 200; // Keep the ISR at a low rate until needed
|
96
|
96
|
|
97
|
97
|
#if ENABLED(LIN_ADVANCE)
|
|
@@ -299,14 +299,16 @@ void Stepper::set_directions() {
|
299
|
299
|
SET_STEP_DIR(Z); // C
|
300
|
300
|
#endif
|
301
|
301
|
|
302
|
|
- if (motor_direction(E_AXIS)) {
|
303
|
|
- REV_E_DIR();
|
304
|
|
- count_direction[E_AXIS] = -1;
|
305
|
|
- }
|
306
|
|
- else {
|
307
|
|
- NORM_E_DIR();
|
308
|
|
- count_direction[E_AXIS] = 1;
|
309
|
|
- }
|
|
302
|
+ #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
|
|
303
|
+ if (motor_direction(E_AXIS)) {
|
|
304
|
+ REV_E_DIR();
|
|
305
|
+ count_direction[E_AXIS] = -1;
|
|
306
|
+ }
|
|
307
|
+ else {
|
|
308
|
+ NORM_E_DIR();
|
|
309
|
+ count_direction[E_AXIS] = 1;
|
|
310
|
+ }
|
|
311
|
+ #endif // !ADVANCE && !LIN_ADVANCE
|
310
|
312
|
}
|
311
|
313
|
|
312
|
314
|
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
|
|
@@ -680,15 +682,29 @@ void Stepper::isr() {
|
680
|
682
|
old_OCR0A += eISR_Rate;
|
681
|
683
|
OCR0A = old_OCR0A;
|
682
|
684
|
|
|
685
|
+ #define SET_E_STEP_DIR(INDEX) \
|
|
686
|
+ if (e_steps[INDEX]) E## INDEX ##_DIR_WRITE(e_steps[INDEX] < 0 ? INVERT_E## INDEX ##_DIR : !INVERT_E## INDEX ##_DIR)
|
|
687
|
+
|
683
|
688
|
#define START_E_PULSE(INDEX) \
|
684
|
689
|
if (e_steps[INDEX]) E## INDEX ##_STEP_WRITE(!INVERT_E_STEP_PIN)
|
685
|
690
|
|
686
|
691
|
#define STOP_E_PULSE(INDEX) \
|
687
|
692
|
if (e_steps[INDEX]) { \
|
688
|
|
- e_steps[INDEX] <= 0 ? ++e_steps[INDEX] : --e_steps[INDEX]; \
|
|
693
|
+ e_steps[INDEX] < 0 ? ++e_steps[INDEX] : --e_steps[INDEX]; \
|
689
|
694
|
E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); \
|
690
|
695
|
}
|
691
|
696
|
|
|
697
|
+ SET_E_STEP_DIR(0);
|
|
698
|
+ #if E_STEPPERS > 1
|
|
699
|
+ SET_E_STEP_DIR(1);
|
|
700
|
+ #if E_STEPPERS > 2
|
|
701
|
+ SET_E_STEP_DIR(2);
|
|
702
|
+ #if E_STEPPERS > 3
|
|
703
|
+ SET_E_STEP_DIR(3);
|
|
704
|
+ #endif
|
|
705
|
+ #endif
|
|
706
|
+ #endif
|
|
707
|
+
|
692
|
708
|
#define CYCLES_EATEN_BY_E 60
|
693
|
709
|
|
694
|
710
|
// Step all E steppers that have steps
|