|
@@ -676,60 +676,34 @@ ISR(TIMER1_COMPA_vect) {
|
676
|
676
|
#endif //ADVANCE
|
677
|
677
|
|
678
|
678
|
#define _COUNTER(axis) counter_## axis
|
679
|
|
- #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
|
680
|
679
|
#define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
|
681
|
680
|
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
|
682
|
681
|
|
683
|
|
- #ifdef CONFIG_STEPPERS_TOSHIBA
|
684
|
|
- /**
|
685
|
|
- * The Toshiba stepper controller require much longer pulses.
|
686
|
|
- * So we 'stage' decompose the pulses between high and low
|
687
|
|
- * instead of doing each in turn. The extra tests add enough
|
688
|
|
- * lag to allow it work with without needing NOPs
|
689
|
|
- */
|
690
|
|
- #define STEP_ADD(axis, AXIS) \
|
691
|
|
- _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
692
|
|
- if (_COUNTER(axis) > 0) { _WRITE_STEP(AXIS, HIGH); }
|
693
|
|
- STEP_ADD(x,X);
|
694
|
|
- STEP_ADD(y,Y);
|
695
|
|
- STEP_ADD(z,Z);
|
696
|
|
- #ifndef ADVANCE
|
697
|
|
- STEP_ADD(e,E);
|
698
|
|
- #endif
|
699
|
|
-
|
700
|
|
- #define STEP_IF_COUNTER(axis, AXIS) \
|
701
|
|
- if (_COUNTER(axis) > 0) { \
|
702
|
|
- _COUNTER(axis) -= current_block->step_event_count; \
|
703
|
|
- count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
704
|
|
- _WRITE_STEP(AXIS, LOW); \
|
705
|
|
- }
|
706
|
|
-
|
707
|
|
- STEP_IF_COUNTER(x, X);
|
708
|
|
- STEP_IF_COUNTER(y, Y);
|
709
|
|
- STEP_IF_COUNTER(z, Z);
|
710
|
|
- #ifndef ADVANCE
|
711
|
|
- STEP_IF_COUNTER(e, E);
|
712
|
|
- #endif
|
|
682
|
+ #define STEP_ADD(axis, AXIS) \
|
|
683
|
+ _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
|
684
|
+ if (_COUNTER(axis) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
|
713
|
685
|
|
714
|
|
- #else // !CONFIG_STEPPERS_TOSHIBA
|
|
686
|
+ STEP_ADD(x,X);
|
|
687
|
+ STEP_ADD(y,Y);
|
|
688
|
+ STEP_ADD(z,Z);
|
|
689
|
+ #ifndef ADVANCE
|
|
690
|
+ STEP_ADD(e,E);
|
|
691
|
+ #endif
|
715
|
692
|
|
716
|
|
- #define APPLY_MOVEMENT(axis, AXIS) \
|
717
|
|
- _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
718
|
|
- if (_COUNTER(axis) > 0) { \
|
719
|
|
- _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
|
720
|
|
- _COUNTER(axis) -= current_block->step_event_count; \
|
721
|
|
- count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
722
|
|
- _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
|
723
|
|
- }
|
|
693
|
+ #define STEP_IF_COUNTER(axis, AXIS) \
|
|
694
|
+ if (_COUNTER(axis) > 0) { \
|
|
695
|
+ _COUNTER(axis) -= current_block->step_event_count; \
|
|
696
|
+ count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
|
697
|
+ _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
|
|
698
|
+ }
|
724
|
699
|
|
725
|
|
- APPLY_MOVEMENT(x, X);
|
726
|
|
- APPLY_MOVEMENT(y, Y);
|
727
|
|
- APPLY_MOVEMENT(z, Z);
|
728
|
|
- #ifndef ADVANCE
|
729
|
|
- APPLY_MOVEMENT(e, E);
|
730
|
|
- #endif
|
|
700
|
+ STEP_IF_COUNTER(x, X);
|
|
701
|
+ STEP_IF_COUNTER(y, Y);
|
|
702
|
+ STEP_IF_COUNTER(z, Z);
|
|
703
|
+ #ifndef ADVANCE
|
|
704
|
+ STEP_IF_COUNTER(e, E);
|
|
705
|
+ #endif
|
731
|
706
|
|
732
|
|
- #endif // CONFIG_STEPPERS_TOSHIBA
|
733
|
707
|
step_events_completed++;
|
734
|
708
|
if (step_events_completed >= current_block->step_event_count) break;
|
735
|
709
|
}
|
|
@@ -1024,6 +998,7 @@ void st_init() {
|
1024
|
998
|
#endif
|
1025
|
999
|
|
1026
|
1000
|
#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
|
|
1001
|
+ #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
|
1027
|
1002
|
#define _DISABLE(axis) disable_## axis()
|
1028
|
1003
|
|
1029
|
1004
|
#define AXIS_INIT(axis, AXIS, PIN) \
|