@@ -2503,14 +2503,15 @@ uint32_t Stepper::block_phase_isr() {
2503
2503
advance_divisor = step_event_count << 1 ;
2504
2504
2505
2505
#if HAS_SHAPING_X
2506
- int32_t echo_x;
2506
+ int32_t echo_x = 0 ;
2507
2507
#endif
2508
2508
#if HAS_SHAPING_Y
2509
- int32_t echo_y;
2509
+ int32_t echo_y = 0 ;
2510
2510
#endif
2511
2511
2512
2512
if (TERN0 (HAS_SHAPING_X, shaping_x.frequency )) {
2513
2513
const int64_t steps = TEST (current_block->direction_bits , X_AXIS) ? -int64_t (current_block->steps .x ) : int64_t (current_block->steps .x );
2514
+ UNUSED (steps);
2514
2515
TERN_ (HAS_SHAPING_X, shaping_x.last_block_end_pos += steps);
2515
2516
2516
2517
// For input shaped axes, advance_divisor is replaced with 0x20000000
@@ -2547,6 +2548,7 @@ uint32_t Stepper::block_phase_isr() {
2547
2548
// Y follows the same logic as X (but the comments aren't repeated)
2548
2549
if (TERN0 (HAS_SHAPING_Y, shaping_y.frequency )) {
2549
2550
const int64_t steps = TEST (current_block->direction_bits , Y_AXIS) ? -int64_t (current_block->steps .y ) : int64_t (current_block->steps .y );
2551
+ UNUSED (steps);
2550
2552
TERN_ (HAS_SHAPING_Y, shaping_y.last_block_end_pos += steps);
2551
2553
TERN_ (HAS_SHAPING_Y, advance_dividend.y = ((steps << 29 ) + shaping_y.remainder ) / step_event_count);
2552
2554
TERN_ (HAS_SHAPING_Y, LIMIT (advance_dividend.y , -0x20000000 , 0x20000000 ));
@@ -2557,7 +2559,8 @@ uint32_t Stepper::block_phase_isr() {
2557
2559
}
2558
2560
2559
2561
// plan the change of values for advance_dividend for the input shaping echoes
2560
- TERN_ (INPUT_SHAPING, shaping_dividend_queue.enqueue (TERN0 (HAS_SHAPING_X, echo_x), TERN0 (HAS_SHAPING_Y, echo_y)));
2562
+ if (TERN0 (HAS_SHAPING_X, shaping_x.frequency ) || TERN0 (HAS_SHAPING_Y, shaping_y.frequency ))
2563
+ TERN_ (INPUT_SHAPING, shaping_dividend_queue.enqueue (TERN0 (HAS_SHAPING_X, echo_x), TERN0 (HAS_SHAPING_Y, echo_y)));
2561
2564
2562
2565
// No step events completed so far
2563
2566
step_events_completed = 0 ;
@@ -3048,10 +3051,16 @@ void Stepper::init() {
3048
3051
if (TERN0 (HAS_SHAPING_X, axis == X_AXIS)) {
3049
3052
DelayTimeManager::set_delay (X_AXIS, delay);
3050
3053
TERN_ (HAS_SHAPING_X, shaping_x.frequency = freq);
3054
+ delta_error = 0L ;
3055
+ shaping_x.last_block_end_pos = count_position.x ;
3056
+ shaping_x.dividend = shaping_x.remainder = 0UL ;
3051
3057
}
3052
3058
if (TERN0 (HAS_SHAPING_Y, axis == Y_AXIS)) {
3053
3059
DelayTimeManager::set_delay (Y_AXIS, delay);
3054
3060
TERN_ (HAS_SHAPING_Y, shaping_y.frequency = freq);
3061
+ delta_error = 0L ;
3062
+ shaping_y.last_block_end_pos = count_position.y ;
3063
+ shaping_y.dividend = shaping_y.remainder = 0UL ;
3055
3064
}
3056
3065
3057
3066
if (was_on) hal.isr_on ();
@@ -3111,10 +3120,14 @@ void Stepper::_set_position(const abce_long_t &spos) {
3111
3120
count_position = spos;
3112
3121
#endif
3113
3122
3114
- TERN_ (HAS_SHAPING_X, count_position.x += x_shaping_delta);
3115
- TERN_ (HAS_SHAPING_X, shaping_x.last_block_end_pos = spos.x );
3116
- TERN_ (HAS_SHAPING_Y, count_position.y += y_shaping_delta);
3117
- TERN_ (HAS_SHAPING_Y, shaping_y.last_block_end_pos = spos.y );
3123
+ if (TERN0 (HAS_SHAPING_X, shaping_x.frequency )) {
3124
+ TERN_ (HAS_SHAPING_X, count_position.x += x_shaping_delta);
3125
+ TERN_ (HAS_SHAPING_X, shaping_x.last_block_end_pos = spos.x );
3126
+ }
3127
+ if (TERN0 (HAS_SHAPING_Y, shaping_y.frequency )) {
3128
+ TERN_ (HAS_SHAPING_Y, count_position.y += y_shaping_delta);
3129
+ TERN_ (HAS_SHAPING_Y, shaping_y.last_block_end_pos = spos.y );
3130
+ }
3118
3131
}
3119
3132
3120
3133
/* *
0 commit comments