|
|
@ -676,60 +676,34 @@ ISR(TIMER1_COMPA_vect) {
|
|
|
|
#endif //ADVANCE
|
|
|
|
#endif //ADVANCE
|
|
|
|
|
|
|
|
|
|
|
|
#define _COUNTER(axis) counter_## axis
|
|
|
|
#define _COUNTER(axis) counter_## axis
|
|
|
|
#define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
|
|
|
|
|
|
|
|
#define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
|
|
|
|
#define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
|
|
|
|
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
|
|
|
|
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_STEPPERS_TOSHIBA
|
|
|
|
#define STEP_ADD(axis, AXIS) \
|
|
|
|
/**
|
|
|
|
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
|
|
|
* The Toshiba stepper controller require much longer pulses.
|
|
|
|
if (_COUNTER(axis) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
|
|
|
|
* 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); }
|
|
|
|
|
|
|
|
STEP_ADD(x,X);
|
|
|
|
|
|
|
|
STEP_ADD(y,Y);
|
|
|
|
|
|
|
|
STEP_ADD(z,Z);
|
|
|
|
|
|
|
|
#ifndef ADVANCE
|
|
|
|
|
|
|
|
STEP_ADD(e,E);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define STEP_IF_COUNTER(axis, AXIS) \
|
|
|
|
|
|
|
|
if (_COUNTER(axis) > 0) { \
|
|
|
|
|
|
|
|
_COUNTER(axis) -= current_block->step_event_count; \
|
|
|
|
|
|
|
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
|
|
|
|
|
|
|
_WRITE_STEP(AXIS, LOW); \
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(x, X);
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(y, Y);
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(z, Z);
|
|
|
|
|
|
|
|
#ifndef ADVANCE
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(e, E);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else // !CONFIG_STEPPERS_TOSHIBA
|
|
|
|
STEP_ADD(x,X);
|
|
|
|
|
|
|
|
STEP_ADD(y,Y);
|
|
|
|
|
|
|
|
STEP_ADD(z,Z);
|
|
|
|
|
|
|
|
#ifndef ADVANCE
|
|
|
|
|
|
|
|
STEP_ADD(e,E);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define APPLY_MOVEMENT(axis, AXIS) \
|
|
|
|
#define STEP_IF_COUNTER(axis, AXIS) \
|
|
|
|
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
|
|
|
if (_COUNTER(axis) > 0) { \
|
|
|
|
if (_COUNTER(axis) > 0) { \
|
|
|
|
_COUNTER(axis) -= current_block->step_event_count; \
|
|
|
|
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
|
|
|
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
|
|
|
_COUNTER(axis) -= current_block->step_event_count; \
|
|
|
|
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
|
|
|
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
|
|
|
}
|
|
|
|
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
APPLY_MOVEMENT(x, X);
|
|
|
|
STEP_IF_COUNTER(x, X);
|
|
|
|
APPLY_MOVEMENT(y, Y);
|
|
|
|
STEP_IF_COUNTER(y, Y);
|
|
|
|
APPLY_MOVEMENT(z, Z);
|
|
|
|
STEP_IF_COUNTER(z, Z);
|
|
|
|
#ifndef ADVANCE
|
|
|
|
#ifndef ADVANCE
|
|
|
|
APPLY_MOVEMENT(e, E);
|
|
|
|
STEP_IF_COUNTER(e, E);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CONFIG_STEPPERS_TOSHIBA
|
|
|
|
|
|
|
|
step_events_completed++;
|
|
|
|
step_events_completed++;
|
|
|
|
if (step_events_completed >= current_block->step_event_count) break;
|
|
|
|
if (step_events_completed >= current_block->step_event_count) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1024,6 +998,7 @@ void st_init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
|
|
|
|
#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
|
|
|
|
|
|
|
|
#define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
|
|
|
|
#define _DISABLE(axis) disable_## axis()
|
|
|
|
#define _DISABLE(axis) disable_## axis()
|
|
|
|
|
|
|
|
|
|
|
|
#define AXIS_INIT(axis, AXIS, PIN) \
|
|
|
|
#define AXIS_INIT(axis, AXIS, PIN) \
|
|
|
|