|
|
@ -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) \
|
|
|
|
STEP_ADD(x,X);
|
|
|
|
if (_COUNTER(axis) > 0) { \
|
|
|
|
STEP_ADD(y,Y);
|
|
|
|
_COUNTER(axis) -= current_block->step_event_count; \
|
|
|
|
STEP_ADD(z,Z);
|
|
|
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
|
|
|
#ifndef ADVANCE
|
|
|
|
_WRITE_STEP(AXIS, LOW); \
|
|
|
|
STEP_ADD(e,E);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(x, X);
|
|
|
|
#define STEP_IF_COUNTER(axis, AXIS) \
|
|
|
|
STEP_IF_COUNTER(y, Y);
|
|
|
|
if (_COUNTER(axis) > 0) { \
|
|
|
|
STEP_IF_COUNTER(z, Z);
|
|
|
|
_COUNTER(axis) -= current_block->step_event_count; \
|
|
|
|
#ifndef ADVANCE
|
|
|
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
|
|
|
STEP_IF_COUNTER(e, E);
|
|
|
|
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else // !CONFIG_STEPPERS_TOSHIBA
|
|
|
|
STEP_IF_COUNTER(x, X);
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(y, Y);
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(z, Z);
|
|
|
|
|
|
|
|
#ifndef ADVANCE
|
|
|
|
|
|
|
|
STEP_IF_COUNTER(e, E);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#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++;
|
|
|
|
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) \
|
|
|
|