Merge pull request #2032 from Wurstnase/toshiba_for_all_stepper

We don't need the old standard one. The STEP_ADD and STEP_IF_COUNTER …
This commit is contained in:
Scott Lahteine 2015-05-08 20:32:30 -07:00
commit be77cfd895

View File

@ -676,20 +676,13 @@ ISR(TIMER1_COMPA_vect) {
#endif //ADVANCE
#define _COUNTER(axis) counter_## axis
#define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
#define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
#ifdef CONFIG_STEPPERS_TOSHIBA
/**
* The Toshiba stepper controller require much longer pulses.
* So we 'stage' decompose the pulses between high and low
* instead of doing each in turn. The extra tests add enough
* lag to allow it work with without needing NOPs
*/
#define STEP_ADD(axis, AXIS) \
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { _WRITE_STEP(AXIS, HIGH); }
if (_COUNTER(axis) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
STEP_ADD(x,X);
STEP_ADD(y,Y);
STEP_ADD(z,Z);
@ -701,7 +694,7 @@ ISR(TIMER1_COMPA_vect) {
if (_COUNTER(axis) > 0) { \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_WRITE_STEP(AXIS, LOW); \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
STEP_IF_COUNTER(x, X);
@ -711,25 +704,6 @@ ISR(TIMER1_COMPA_vect) {
STEP_IF_COUNTER(e, E);
#endif
#else // !CONFIG_STEPPERS_TOSHIBA
#define APPLY_MOVEMENT(axis, AXIS) \
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
APPLY_MOVEMENT(x, X);
APPLY_MOVEMENT(y, Y);
APPLY_MOVEMENT(z, Z);
#ifndef ADVANCE
APPLY_MOVEMENT(e, E);
#endif
#endif // CONFIG_STEPPERS_TOSHIBA
step_events_completed++;
if (step_events_completed >= current_block->step_event_count) break;
}
@ -1024,6 +998,7 @@ void st_init() {
#endif
#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
#define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
#define _DISABLE(axis) disable_## axis()
#define AXIS_INIT(axis, AXIS, PIN) \