Simplified fix for babystep pulse width
Alternative to the apparently superfluous double delay
This commit is contained in:
parent
65270d6a96
commit
7dc03ce721
1 changed files with 5 additions and 5 deletions
|
@ -2136,8 +2136,7 @@ void Stepper::report_positions() {
|
|||
#define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
|
||||
|
||||
#if EXTRA_CYCLES_BABYSTEP > 20
|
||||
hal_timer_t pulse_start;
|
||||
#define _SAVE_START pulse_start = HAL_timer_get_count(STEP_TIMER_NUM)
|
||||
#define _SAVE_START const hal_timer_t 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 */ }
|
||||
#else
|
||||
#define _SAVE_START NOOP
|
||||
|
@ -2155,11 +2154,10 @@ void Stepper::report_positions() {
|
|||
#define BABYSTEP_AXIS(AXIS, INVERT, DIR) { \
|
||||
const uint8_t old_dir = _READ_DIR(AXIS); \
|
||||
_ENABLE(AXIS); \
|
||||
_SAVE_START; \
|
||||
_APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^DIR^INVERT); \
|
||||
_PULSE_WAIT; \
|
||||
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
|
||||
DELAY_NS(400); /* DRV8825 */ \
|
||||
_SAVE_START; \
|
||||
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
|
||||
_PULSE_WAIT; \
|
||||
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
|
||||
_APPLY_DIR(AXIS, old_dir); \
|
||||
|
@ -2229,6 +2227,8 @@ void Stepper::report_positions() {
|
|||
Y_DIR_WRITE(INVERT_Y_DIR ^ z_direction);
|
||||
Z_DIR_WRITE(INVERT_Z_DIR ^ z_direction);
|
||||
|
||||
DELAY_NS(400); // DRV8825
|
||||
|
||||
_SAVE_START;
|
||||
|
||||
X_STEP_WRITE(!INVERT_X_STEP_PIN);
|
||||
|
|
Reference in a new issue