MINIMUM_STEPPER_PULSE option

master
Scott Lahteine 8 years ago
parent 2cb63f0bf7
commit 759234af60

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -539,6 +539,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 3 #define MIN_STEPS_PER_SEGMENT 3
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -541,6 +541,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -535,6 +535,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -535,6 +535,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -534,6 +534,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -539,6 +539,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -535,6 +535,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -533,6 +533,10 @@
// Moves (or segments) with fewer steps than this will be joined with the next move // Moves (or segments) with fewer steps than this will be joined with the next move
#define MIN_STEPS_PER_SEGMENT 6 #define MIN_STEPS_PER_SEGMENT 6
// The minimum pulse width (in µs) for stepping a stepper.
// Set this if you find stepping unreliable, or if using a very fast CPU.
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// @section temperature // @section temperature
// Control heater 0 and heater 1 in parallel. // Control heater 0 and heater 1 in parallel.

@ -449,18 +449,30 @@ void Stepper::isr() {
#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
#define STEP_ADD(AXIS) \ #define PULSE_START(AXIS) \
_COUNTER(AXIS) += current_block->steps[_AXIS(AXIS)]; \ _COUNTER(AXIS) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(AXIS) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); } if (_COUNTER(AXIS) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
#define PULSE_STOP(AXIS) \
if (_COUNTER(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); \
}
#if MINIMUM_STEPPER_PULSE > 0
static uint32_t pulse_start;
pulse_start = TCNT0;
#endif
#if HAS_X_STEP #if HAS_X_STEP
STEP_ADD(X); PULSE_START(X);
#endif #endif
#if HAS_Y_STEP #if HAS_Y_STEP
STEP_ADD(Y); PULSE_START(Y);
#endif #endif
#if HAS_Z_STEP #if HAS_Z_STEP
STEP_ADD(Z); PULSE_START(Z);
#endif #endif
#if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE) #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
@ -475,25 +487,23 @@ void Stepper::isr() {
if (counter_M[j] > 0) En_STEP_WRITE(j, !INVERT_E_STEP_PIN); if (counter_M[j] > 0) En_STEP_WRITE(j, !INVERT_E_STEP_PIN);
} }
#else // !MIXING_EXTRUDER #else // !MIXING_EXTRUDER
STEP_ADD(E); PULSE_START(E);
#endif #endif
#endif // !ADVANCE && !LIN_ADVANCE #endif // !ADVANCE && !LIN_ADVANCE
#define STEP_IF_COUNTER(AXIS) \ #if MINIMUM_STEPPER_PULSE > 0
if (_COUNTER(AXIS) > 0) { \ #define CYCLES_EATEN_BY_CODE 10
_COUNTER(AXIS) -= current_block->step_event_count; \ while ((uint32_t)(TCNT0 - pulse_start) < (MINIMUM_STEPPER_PULSE * (F_CPU / 1000000UL)) - CYCLES_EATEN_BY_CODE) { /* nada */ }
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ #endif
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
#if HAS_X_STEP #if HAS_X_STEP
STEP_IF_COUNTER(X); PULSE_STOP(X);
#endif #endif
#if HAS_Y_STEP #if HAS_Y_STEP
STEP_IF_COUNTER(Y); PULSE_STOP(Y);
#endif #endif
#if HAS_Z_STEP #if HAS_Z_STEP
STEP_IF_COUNTER(Z); PULSE_STOP(Z);
#endif #endif
#if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE) #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
@ -510,7 +520,7 @@ void Stepper::isr() {
} }
} }
#else // !MIXING_EXTRUDER #else // !MIXING_EXTRUDER
STEP_IF_COUNTER(E); PULSE_STOP(E);
#endif #endif
#endif // !ADVANCE && !LIN_ADVANCE #endif // !ADVANCE && !LIN_ADVANCE

Loading…
Cancel
Save