|
@@ -1263,7 +1263,7 @@ void Stepper::isr() {
|
1263
|
1263
|
#else
|
1264
|
1264
|
1
|
1265
|
1265
|
#endif
|
1266
|
|
- * (HAL_TICKS_PER_US)
|
|
1266
|
+ * (STEPPER_TIMER_TICKS_PER_US)
|
1267
|
1267
|
);
|
1268
|
1268
|
|
1269
|
1269
|
/**
|
|
@@ -1316,10 +1316,10 @@ void Stepper::stepper_pulse_phase_isr() {
|
1316
|
1316
|
// Just update the value we will get at the end of the loop
|
1317
|
1317
|
step_events_completed += events_to_do;
|
1318
|
1318
|
|
1319
|
|
- #if MINIMUM_STEPPER_PULSE
|
1320
|
|
- // Get the timer count and estimate the end of the pulse
|
1321
|
|
- hal_timer_t pulse_end = HAL_timer_get_count(PULSE_TIMER_NUM) + hal_timer_t((HAL_TICKS_PER_US) * (MINIMUM_STEPPER_PULSE));
|
1322
|
|
- #endif
|
|
1319
|
+ // Get the timer count and estimate the end of the pulse
|
|
1320
|
+ hal_timer_t pulse_end = HAL_timer_get_count(PULSE_TIMER_NUM) + hal_timer_t(MIN_PULSE_TICKS);
|
|
1321
|
+
|
|
1322
|
+ const hal_timer_t added_step_ticks = ADDED_STEP_TICKS;
|
1323
|
1323
|
|
1324
|
1324
|
// Take multiple steps per interrupt (For high speed moves)
|
1325
|
1325
|
do {
|
|
@@ -1392,10 +1392,11 @@ void Stepper::stepper_pulse_phase_isr() {
|
1392
|
1392
|
#if MINIMUM_STEPPER_PULSE
|
1393
|
1393
|
// Just wait for the requested pulse duration
|
1394
|
1394
|
while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
|
1395
|
|
- // Add to the value, the value needed for the pulse end and ensuring the maximum driver rate is enforced
|
1396
|
|
- pulse_end += hal_timer_t(MIN_STEPPER_PULSE_CYCLES) - hal_timer_t((HAL_TICKS_PER_US) * (MINIMUM_STEPPER_PULSE));
|
1397
|
1395
|
#endif
|
1398
|
1396
|
|
|
1397
|
+ // Add the delay needed to ensure the maximum driver rate is enforced
|
|
1398
|
+ if (signed(added_step_ticks) > 0) pulse_end += hal_timer_t(added_step_ticks);
|
|
1399
|
+
|
1399
|
1400
|
// Pulse stop
|
1400
|
1401
|
#if HAS_X_STEP
|
1401
|
1402
|
PULSE_STOP(X);
|
|
@@ -1423,15 +1424,15 @@ void Stepper::stepper_pulse_phase_isr() {
|
1423
|
1424
|
// Decrement the count of pending pulses to do
|
1424
|
1425
|
--events_to_do;
|
1425
|
1426
|
|
1426
|
|
- #if MINIMUM_STEPPER_PULSE
|
1427
|
|
- // For minimum pulse time wait after stopping pulses also
|
1428
|
|
- if (events_to_do) {
|
1429
|
|
- // Just wait for the requested pulse duration
|
1430
|
|
- while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
|
|
1427
|
+ // For minimum pulse time wait after stopping pulses also
|
|
1428
|
+ if (events_to_do) {
|
|
1429
|
+ // Just wait for the requested pulse duration
|
|
1430
|
+ while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
|
|
1431
|
+ #if MINIMUM_STEPPER_PULSE
|
1431
|
1432
|
// Add to the value, the time that the pulse must be active (to be used on the next loop)
|
1432
|
|
- pulse_end += hal_timer_t((HAL_TICKS_PER_US) * (MINIMUM_STEPPER_PULSE));
|
1433
|
|
- }
|
1434
|
|
- #endif
|
|
1433
|
+ pulse_end += hal_timer_t(MIN_PULSE_TICKS);
|
|
1434
|
+ #endif
|
|
1435
|
+ }
|
1435
|
1436
|
|
1436
|
1437
|
} while (events_to_do);
|
1437
|
1438
|
}
|
|
@@ -1810,13 +1811,15 @@ uint32_t Stepper::stepper_block_phase_isr() {
|
1810
|
1811
|
REV_E_DIR(active_extruder);
|
1811
|
1812
|
#endif
|
1812
|
1813
|
|
|
1814
|
+ // Get the timer count and estimate the end of the pulse
|
|
1815
|
+ hal_timer_t pulse_end = HAL_timer_get_count(PULSE_TIMER_NUM) + hal_timer_t(MIN_PULSE_TICKS);
|
|
1816
|
+
|
|
1817
|
+ const hal_timer_t added_step_ticks = ADDED_STEP_TICKS;
|
|
1818
|
+
|
1813
|
1819
|
// Step E stepper if we have steps
|
1814
|
1820
|
while (LA_steps) {
|
1815
|
1821
|
|
1816
|
|
- #if MINIMUM_STEPPER_PULSE
|
1817
|
|
- hal_timer_t pulse_end = HAL_timer_get_count(PULSE_TIMER_NUM) + hal_timer_t((HAL_TICKS_PER_US) * (MINIMUM_STEPPER_PULSE));
|
1818
|
|
- #endif
|
1819
|
|
-
|
|
1822
|
+ // Set the STEP pulse ON
|
1820
|
1823
|
#if ENABLED(MIXING_EXTRUDER)
|
1821
|
1824
|
MIXING_STEPPERS_LOOP(j) {
|
1822
|
1825
|
// Step mixing steppers (proportionally)
|
|
@@ -1828,15 +1831,18 @@ uint32_t Stepper::stepper_block_phase_isr() {
|
1828
|
1831
|
E_STEP_WRITE(active_extruder, !INVERT_E_STEP_PIN);
|
1829
|
1832
|
#endif
|
1830
|
1833
|
|
|
1834
|
+ // Enforce a minimum duration for STEP pulse ON
|
1831
|
1835
|
#if MINIMUM_STEPPER_PULSE
|
1832
|
1836
|
// Just wait for the requested pulse duration
|
1833
|
1837
|
while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
|
1834
|
|
- // Add to the value, the value needed for the pulse end and ensuring the maximum driver rate is enforced
|
1835
|
|
- pulse_end += hal_timer_t(MIN_STEPPER_PULSE_CYCLES) - hal_timer_t((HAL_TICKS_PER_US) * (MINIMUM_STEPPER_PULSE));
|
1836
|
1838
|
#endif
|
1837
|
1839
|
|
|
1840
|
+ // Add the delay needed to ensure the maximum driver rate is enforced
|
|
1841
|
+ if (signed(added_step_ticks) > 0) pulse_end += hal_timer_t(added_step_ticks);
|
|
1842
|
+
|
1838
|
1843
|
LA_steps < 0 ? ++LA_steps : --LA_steps;
|
1839
|
1844
|
|
|
1845
|
+ // Set the STEP pulse OFF
|
1840
|
1846
|
#if ENABLED(MIXING_EXTRUDER)
|
1841
|
1847
|
MIXING_STEPPERS_LOOP(j) {
|
1842
|
1848
|
if (delta_error_m[j] >= 0) {
|
|
@@ -1848,12 +1854,15 @@ uint32_t Stepper::stepper_block_phase_isr() {
|
1848
|
1854
|
E_STEP_WRITE(active_extruder, INVERT_E_STEP_PIN);
|
1849
|
1855
|
#endif
|
1850
|
1856
|
|
1851
|
|
- #if MINIMUM_STEPPER_PULSE
|
1852
|
|
- // For minimum pulse time wait before looping
|
1853
|
|
- // Just wait for the requested pulse duration
|
1854
|
|
- if (LA_steps) while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
|
1855
|
|
- #endif
|
1856
|
|
-
|
|
1857
|
+ // For minimum pulse time wait before looping
|
|
1858
|
+ // Just wait for the requested pulse duration
|
|
1859
|
+ if (LA_steps) {
|
|
1860
|
+ while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
|
|
1861
|
+ #if MINIMUM_STEPPER_PULSE
|
|
1862
|
+ // Add to the value, the time that the pulse must be active (to be used on the next loop)
|
|
1863
|
+ pulse_end += hal_timer_t(MIN_PULSE_TICKS);
|
|
1864
|
+ #endif
|
|
1865
|
+ }
|
1857
|
1866
|
} // LA_steps
|
1858
|
1867
|
|
1859
|
1868
|
return interval;
|