🔥 Always use ISR for BABYSTEPPING (#26035)
This commit is contained in:
@@ -2206,7 +2206,6 @@
|
|||||||
*/
|
*/
|
||||||
//#define BABYSTEPPING
|
//#define BABYSTEPPING
|
||||||
#if ENABLED(BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
//#define INTEGRATED_BABYSTEPPING // Integration of babystepping into the Stepper ISR
|
|
||||||
//#define EP_BABYSTEPPING // M293/M294 babystepping with EMERGENCY_PARSER support
|
//#define EP_BABYSTEPPING // M293/M294 babystepping with EMERGENCY_PARSER support
|
||||||
//#define BABYSTEP_WITHOUT_HOMING
|
//#define BABYSTEP_WITHOUT_HOMING
|
||||||
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement)
|
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement)
|
||||||
|
@@ -52,10 +52,6 @@
|
|||||||
#error "FAST_PWM_FAN is not available on TinyBee."
|
#error "FAST_PWM_FAN is not available on TinyBee."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ALL(I2S_STEPPER_STREAM, BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING)
|
|
||||||
#error "BABYSTEPPING on I2S stream requires INTEGRATED_BABYSTEPPING."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USING_PULLDOWNS
|
#if USING_PULLDOWNS
|
||||||
#error "PULLDOWN pin mode is not available on ESP32 boards."
|
#error "PULLDOWN pin mode is not available on ESP32 boards."
|
||||||
#endif
|
#endif
|
||||||
|
@@ -66,7 +66,7 @@ void Babystep::add_mm(const AxisEnum axis, const_float_t mm) {
|
|||||||
steps[BS_AXIS_IND(axis)] = distance;
|
steps[BS_AXIS_IND(axis)] = distance;
|
||||||
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] = distance);
|
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] = distance);
|
||||||
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
|
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
|
||||||
TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
|
TERN_(BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
|
|||||||
steps[BS_AXIS_IND(axis)] += distance;
|
steps[BS_AXIS_IND(axis)] += distance;
|
||||||
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] += distance);
|
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] += distance);
|
||||||
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
|
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
|
||||||
TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
|
TERN_(BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(EP_BABYSTEPPING)
|
#if ENABLED(EP_BABYSTEPPING)
|
||||||
|
@@ -23,13 +23,8 @@
|
|||||||
|
|
||||||
#include "../inc/MarlinConfigPre.h"
|
#include "../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
|
||||||
#define BABYSTEPS_PER_SEC 1000UL
|
#define BABYSTEPS_PER_SEC 1000UL
|
||||||
#define BABYSTEP_TICKS ((STEPPER_TIMER_RATE) / (BABYSTEPS_PER_SEC))
|
#define BABYSTEP_TICKS ((STEPPER_TIMER_RATE) / (BABYSTEPS_PER_SEC))
|
||||||
#else
|
|
||||||
#define BABYSTEPS_PER_SEC 976UL
|
|
||||||
#define BABYSTEP_TICKS ((TEMP_TIMER_RATE) / (BABYSTEPS_PER_SEC))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ANY(IS_CORE, BABYSTEP_XY, I2C_POSITION_ENCODERS)
|
#if ANY(IS_CORE, BABYSTEP_XY, I2C_POSITION_ENCODERS)
|
||||||
#define BS_AXIS_IND(A) A
|
#define BS_AXIS_IND(A) A
|
||||||
|
@@ -659,6 +659,8 @@
|
|||||||
#error "Z3_USE_ENDSTOP is obsolete. Instead set Z2_STOP_PIN directly. (e.g., 'Z3_USE_ENDSTOP _ZMAX_' becomes 'Z3_STOP_PIN Z_MAX_PIN')"
|
#error "Z3_USE_ENDSTOP is obsolete. Instead set Z2_STOP_PIN directly. (e.g., 'Z3_USE_ENDSTOP _ZMAX_' becomes 'Z3_STOP_PIN Z_MAX_PIN')"
|
||||||
#elif defined(Z4_USE_ENDSTOP)
|
#elif defined(Z4_USE_ENDSTOP)
|
||||||
#error "Z4_USE_ENDSTOP is obsolete. Instead set Z4_STOP_PIN directly. (e.g., 'Z4_USE_ENDSTOP _ZMAX_' becomes 'Z4_STOP_PIN Z_MAX_PIN')"
|
#error "Z4_USE_ENDSTOP is obsolete. Instead set Z4_STOP_PIN directly. (e.g., 'Z4_USE_ENDSTOP _ZMAX_' becomes 'Z4_STOP_PIN Z_MAX_PIN')"
|
||||||
|
#elif defined(INTEGRATED_BABYSTEPPING)
|
||||||
|
#error "INTEGRATED_BABYSTEPPING is no longer needed and should be removed."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// L64xx stepper drivers have been removed
|
// L64xx stepper drivers have been removed
|
||||||
|
@@ -106,7 +106,7 @@ Stepper stepper; // Singleton
|
|||||||
#include "../feature/bedlevel/bdl/bdl.h"
|
#include "../feature/bedlevel/bdl/bdl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
#include "../feature/babystep.h"
|
#include "../feature/babystep.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ uint32_t Stepper::advance_divisor = 0,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
hal_timer_t Stepper::nextBabystepISR = BABYSTEP_NEVER;
|
hal_timer_t Stepper::nextBabystepISR = BABYSTEP_NEVER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1543,7 +1543,7 @@ void Stepper::isr() {
|
|||||||
// Define 2.5 msec task for auxilliary functions.
|
// Define 2.5 msec task for auxilliary functions.
|
||||||
if (!fxdTiCtrl_nextAuxISR) {
|
if (!fxdTiCtrl_nextAuxISR) {
|
||||||
endstops.update();
|
endstops.update();
|
||||||
TERN_(INTEGRATED_BABYSTEPPING, if (babystep.has_steps()) babystepping_isr());
|
TERN_(BABYSTEPPING, if (babystep.has_steps()) babystepping_isr());
|
||||||
fxdTiCtrl_refreshAxisDidMove();
|
fxdTiCtrl_refreshAxisDidMove();
|
||||||
fxdTiCtrl_nextAuxISR = 0.0025f * (STEPPER_TIMER_RATE);
|
fxdTiCtrl_nextAuxISR = 0.0025f * (STEPPER_TIMER_RATE);
|
||||||
}
|
}
|
||||||
@@ -1574,7 +1574,7 @@ void Stepper::isr() {
|
|||||||
nextAdvanceISR = la_interval;
|
nextAdvanceISR = la_interval;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
const bool is_babystep = (nextBabystepISR == 0); // 0 = Do Babystepping (XY)Z pulses
|
const bool is_babystep = (nextBabystepISR == 0); // 0 = Do Babystepping (XY)Z pulses
|
||||||
if (is_babystep) nextBabystepISR = babystepping_isr();
|
if (is_babystep) nextBabystepISR = babystepping_isr();
|
||||||
#endif
|
#endif
|
||||||
@@ -1583,7 +1583,7 @@ void Stepper::isr() {
|
|||||||
|
|
||||||
if (!nextMainISR) nextMainISR = block_phase_isr(); // Manage acc/deceleration, get next block
|
if (!nextMainISR) nextMainISR = block_phase_isr(); // Manage acc/deceleration, get next block
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
if (is_babystep) // Avoid ANY stepping too soon after baby-stepping
|
if (is_babystep) // Avoid ANY stepping too soon after baby-stepping
|
||||||
NOLESS(nextMainISR, (BABYSTEP_TICKS) / 8); // FULL STOP for 125µs after a baby-step
|
NOLESS(nextMainISR, (BABYSTEP_TICKS) / 8); // FULL STOP for 125µs after a baby-step
|
||||||
|
|
||||||
@@ -1596,7 +1596,7 @@ void Stepper::isr() {
|
|||||||
TERN_(INPUT_SHAPING_X, NOMORE(interval, ShapingQueue::peek_x())); // Time until next input shaping echo for X
|
TERN_(INPUT_SHAPING_X, NOMORE(interval, ShapingQueue::peek_x())); // Time until next input shaping echo for X
|
||||||
TERN_(INPUT_SHAPING_Y, NOMORE(interval, ShapingQueue::peek_y())); // Time until next input shaping echo for Y
|
TERN_(INPUT_SHAPING_Y, NOMORE(interval, ShapingQueue::peek_y())); // Time until next input shaping echo for Y
|
||||||
TERN_(LIN_ADVANCE, NOMORE(interval, nextAdvanceISR)); // Come back early for Linear Advance?
|
TERN_(LIN_ADVANCE, NOMORE(interval, nextAdvanceISR)); // Come back early for Linear Advance?
|
||||||
TERN_(INTEGRATED_BABYSTEPPING, NOMORE(interval, nextBabystepISR)); // Come back early for Babystepping?
|
TERN_(BABYSTEPPING, NOMORE(interval, nextBabystepISR)); // Come back early for Babystepping?
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compute remaining time for each ISR phase
|
// Compute remaining time for each ISR phase
|
||||||
@@ -1608,7 +1608,7 @@ void Stepper::isr() {
|
|||||||
nextMainISR -= interval;
|
nextMainISR -= interval;
|
||||||
TERN_(HAS_ZV_SHAPING, ShapingQueue::decrement_delays(interval));
|
TERN_(HAS_ZV_SHAPING, ShapingQueue::decrement_delays(interval));
|
||||||
TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval);
|
TERN_(LIN_ADVANCE, if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval);
|
||||||
TERN_(INTEGRATED_BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval);
|
TERN_(BABYSTEPPING, if (nextBabystepISR != BABYSTEP_NEVER) nextBabystepISR -= interval);
|
||||||
|
|
||||||
} // standard motion control
|
} // standard motion control
|
||||||
|
|
||||||
@@ -2807,7 +2807,7 @@ hal_timer_t Stepper::block_phase_isr() {
|
|||||||
|
|
||||||
#endif // LIN_ADVANCE
|
#endif // LIN_ADVANCE
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
|
|
||||||
// Timer interrupt for baby-stepping
|
// Timer interrupt for baby-stepping
|
||||||
hal_timer_t Stepper::babystepping_isr() {
|
hal_timer_t Stepper::babystepping_isr() {
|
||||||
@@ -3669,7 +3669,7 @@ void Stepper::report_positions() {
|
|||||||
// No other ISR should ever interrupt this!
|
// No other ISR should ever interrupt this!
|
||||||
void Stepper::do_babystep(const AxisEnum axis, const bool direction) {
|
void Stepper::do_babystep(const AxisEnum axis, const bool direction) {
|
||||||
|
|
||||||
IF_DISABLED(INTEGRATED_BABYSTEPPING, cli());
|
IF_DISABLED(BABYSTEPPING, cli());
|
||||||
|
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
|
|
||||||
@@ -3750,7 +3750,7 @@ void Stepper::report_positions() {
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF_DISABLED(INTEGRATED_BABYSTEPPING, sei());
|
IF_DISABLED(BABYSTEPPING, sei());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BABYSTEPPING
|
#endif // BABYSTEPPING
|
||||||
|
@@ -416,7 +416,7 @@ class Stepper {
|
|||||||
static bool la_active; // Whether linear advance is used on the present segment.
|
static bool la_active; // Whether linear advance is used on the present segment.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
static constexpr hal_timer_t BABYSTEP_NEVER = HAL_TIMER_TYPE_MAX;
|
static constexpr hal_timer_t BABYSTEP_NEVER = HAL_TIMER_TYPE_MAX;
|
||||||
static hal_timer_t nextBabystepISR;
|
static hal_timer_t nextBabystepISR;
|
||||||
#endif
|
#endif
|
||||||
@@ -475,7 +475,7 @@ class Stepper {
|
|||||||
static void advance_isr();
|
static void advance_isr();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(INTEGRATED_BABYSTEPPING)
|
#if ENABLED(BABYSTEPPING)
|
||||||
// The Babystepping ISR phase
|
// The Babystepping ISR phase
|
||||||
static hal_timer_t babystepping_isr();
|
static hal_timer_t babystepping_isr();
|
||||||
FORCE_INLINE static void initiateBabystepping() {
|
FORCE_INLINE static void initiateBabystepping() {
|
||||||
|
@@ -160,10 +160,6 @@
|
|||||||
#include "stepper.h"
|
#include "stepper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING)
|
|
||||||
#include "../feature/babystep.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
#include "../feature/filwidth.h"
|
#include "../feature/filwidth.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -4122,10 +4118,6 @@ void Temperature::isr() {
|
|||||||
// Additional ~1kHz Tasks
|
// Additional ~1kHz Tasks
|
||||||
//
|
//
|
||||||
|
|
||||||
#if ENABLED(BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING)
|
|
||||||
babystep.task();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check fan tachometers
|
// Check fan tachometers
|
||||||
TERN_(HAS_FANCHECK, fan_check.update_tachometers());
|
TERN_(HAS_FANCHECK, fan_check.update_tachometers());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user