add delay between pulse edges (#10778)

This commit is contained in:
Bob Kuhn 2018-05-19 17:12:16 -05:00 committed by Scott Lahteine
parent fe7aea7bf6
commit 9ad42d6617

View file

@ -2114,7 +2114,8 @@ void Stepper::report_positions() {
#define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true) #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
#if EXTRA_CYCLES_BABYSTEP > 20 #if EXTRA_CYCLES_BABYSTEP > 20
#define _SAVE_START const hal_timer_t pulse_start = HAL_timer_get_count(STEP_TIMER_NUM) hal_timer_t pulse_start;
#define _SAVE_START pulse_start = HAL_timer_get_count(STEP_TIMER_NUM)
#define _PULSE_WAIT while (EXTRA_CYCLES_BABYSTEP > (uint32_t)(HAL_timer_get_count(STEP_TIMER_NUM) - pulse_start) * (PULSE_TIMER_PRESCALE)) { /* nada */ } #define _PULSE_WAIT while (EXTRA_CYCLES_BABYSTEP > (uint32_t)(HAL_timer_get_count(STEP_TIMER_NUM) - pulse_start) * (PULSE_TIMER_PRESCALE)) { /* nada */ }
#else #else
#define _SAVE_START NOOP #define _SAVE_START NOOP
@ -2136,6 +2137,7 @@ void Stepper::report_positions() {
_APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^DIR^INVERT); \ _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^DIR^INVERT); \
_PULSE_WAIT; \ _PULSE_WAIT; \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \ _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
_SAVE_START; \
_PULSE_WAIT; \ _PULSE_WAIT; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \ _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
_APPLY_DIR(AXIS, old_dir); \ _APPLY_DIR(AXIS, old_dir); \