Commit f81c468 1 parent b3f65b6 commit f81c468 Copy full SHA for f81c468
File tree 1 file changed +15
-17
lines changed
1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -149,30 +149,28 @@ void stepperTask(void *parameter) {
149
149
dma.rw_pos = 0 ;
150
150
151
151
while (dma.rw_pos < DMA_SAMPLE_COUNT) {
152
- // Fill with the port data post pulse_phase until the next step
153
- if (nextMainISR && TERN1 (LIN_ADVANCE, nextAdvanceISR))
154
- i2s_push_sample ();
155
-
156
- // i2s_push_sample() is also called from Stepper::pulse_phase_isr() and Stepper::advance_isr()
157
- // in a rare case where both are called, we need to double decrement the counters
158
- const uint8_t push_count = 1 + (!nextMainISR && TERN0 (LIN_ADVANCE, !nextAdvanceISR));
159
-
152
+ if (!nextMainISR) {
153
+ Stepper::pulse_phase_isr ();
154
+ nextMainISR = Stepper::block_phase_isr ();
155
+ }
160
156
#if ENABLED(LIN_ADVANCE)
161
- if (!nextAdvanceISR) {
157
+ else if (!nextAdvanceISR) {
162
158
Stepper::advance_isr ();
163
159
nextAdvanceISR = Stepper::la_interval;
164
160
}
165
- else if (nextAdvanceISR == Stepper::LA_ADV_NEVER)
166
- nextAdvanceISR = Stepper::la_interval;
167
161
#endif
162
+ else
163
+ i2s_push_sample ();
168
164
169
- if (!nextMainISR) {
170
- Stepper::pulse_phase_isr ();
171
- nextMainISR = Stepper::block_phase_isr ();
172
- }
165
+ nextMainISR--;
173
166
174
- nextMainISR -= push_count;
175
- TERN_ (LIN_ADVANCE, nextAdvanceISR -= push_count);
167
+ #if ENABLED(LIN_ADVANCE)
168
+ if (nextAdvanceISR == Stepper::LA_ADV_NEVER)
169
+ nextAdvanceISR = Stepper::la_interval;
170
+
171
+ if (nextAdvanceISR && nextAdvanceISR != Stepper::LA_ADV_NEVER)
172
+ nextAdvanceISR--;
173
+ #endif
176
174
}
177
175
}
178
176
}
You can’t perform that action at this time.
0 commit comments