|
@@ -137,6 +137,10 @@ Stepper stepper; // Singleton
|
137
|
137
|
#include "../lcd/extui/ui_api.h"
|
138
|
138
|
#endif
|
139
|
139
|
|
|
140
|
+#if ENABLED(I2S_STEPPER_STREAM)
|
|
141
|
+ #include "../HAL/ESP32/i2s.h"
|
|
142
|
+#endif
|
|
143
|
+
|
140
|
144
|
// public:
|
141
|
145
|
|
142
|
146
|
#if EITHER(HAS_EXTRA_ENDSTOPS, Z_STEPPER_AUTO_ALIGN)
|
|
@@ -1558,14 +1562,7 @@ void Stepper::isr() {
|
1558
|
1562
|
* On AVR the ISR epilogue+prologue is estimated at 100 instructions - Give 8µs as margin
|
1559
|
1563
|
* On ARM the ISR epilogue+prologue is estimated at 20 instructions - Give 1µs as margin
|
1560
|
1564
|
*/
|
1561
|
|
- min_ticks = HAL_timer_get_count(MF_TIMER_STEP) + hal_timer_t(
|
1562
|
|
- #ifdef __AVR__
|
1563
|
|
- 8
|
1564
|
|
- #else
|
1565
|
|
- 1
|
1566
|
|
- #endif
|
1567
|
|
- * (STEPPER_TIMER_TICKS_PER_US)
|
1568
|
|
- );
|
|
1565
|
+ min_ticks = HAL_timer_get_count(MF_TIMER_STEP) + hal_timer_t(TERN(__AVR__, 8, 1) * (STEPPER_TIMER_TICKS_PER_US));
|
1569
|
1566
|
|
1570
|
1567
|
/**
|
1571
|
1568
|
* NB: If for some reason the stepper monopolizes the MPU, eventually the
|
|
@@ -2472,18 +2469,19 @@ uint32_t Stepper::block_phase_isr() {
|
2472
|
2469
|
// the acceleration and speed values calculated in block_phase_isr().
|
2473
|
2470
|
// This helps keep LA in sync with, for example, S_CURVE_ACCELERATION.
|
2474
|
2471
|
la_delta_error += la_dividend;
|
2475
|
|
- if (la_delta_error >= 0) {
|
|
2472
|
+ const bool step_needed = la_delta_error >= 0;
|
|
2473
|
+ if (step_needed) {
|
2476
|
2474
|
count_position.e += count_direction.e;
|
2477
|
2475
|
la_advance_steps += count_direction.e;
|
2478
|
2476
|
la_delta_error -= advance_divisor;
|
2479
|
2477
|
|
2480
|
2478
|
// Set the STEP pulse ON
|
2481
|
|
- #if ENABLED(MIXING_EXTRUDER)
|
2482
|
|
- E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN);
|
2483
|
|
- #else
|
2484
|
|
- E_STEP_WRITE(stepper_extruder, !INVERT_E_STEP_PIN);
|
2485
|
|
- #endif
|
|
2479
|
+ E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_next_stepper(), stepper_extruder), !INVERT_E_STEP_PIN);
|
|
2480
|
+ }
|
|
2481
|
+
|
|
2482
|
+ TERN_(I2S_STEPPER_STREAM, i2s_push_sample());
|
2486
|
2483
|
|
|
2484
|
+ if (step_needed) {
|
2487
|
2485
|
// Enforce a minimum duration for STEP pulse ON
|
2488
|
2486
|
#if ISR_PULSE_CONTROL
|
2489
|
2487
|
USING_TIMED_PULSE();
|
|
@@ -2492,11 +2490,7 @@ uint32_t Stepper::block_phase_isr() {
|
2492
|
2490
|
#endif
|
2493
|
2491
|
|
2494
|
2492
|
// Set the STEP pulse OFF
|
2495
|
|
- #if ENABLED(MIXING_EXTRUDER)
|
2496
|
|
- E_STEP_WRITE(mixer.get_stepper(), INVERT_E_STEP_PIN);
|
2497
|
|
- #else
|
2498
|
|
- E_STEP_WRITE(stepper_extruder, INVERT_E_STEP_PIN);
|
2499
|
|
- #endif
|
|
2493
|
+ E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_stepper(), stepper_extruder), INVERT_E_STEP_PIN);
|
2500
|
2494
|
}
|
2501
|
2495
|
}
|
2502
|
2496
|
|