|
@@ -180,7 +180,7 @@ void Planner::calculate_trapezoid_for_block(block_t* const block, const float &e
|
180
|
180
|
// block->decelerate_after = accelerate_steps+plateau_steps;
|
181
|
181
|
|
182
|
182
|
CRITICAL_SECTION_START; // Fill variables used by the stepper in a critical section
|
183
|
|
- if (!block->busy) { // Don't update variables if block is busy.
|
|
183
|
+ if (!TEST(block->flag, BLOCK_BIT_BUSY)) { // Don't update variables if block is busy.
|
184
|
184
|
block->accelerate_until = accelerate_steps;
|
185
|
185
|
block->decelerate_after = accelerate_steps + plateau_steps;
|
186
|
186
|
block->initial_rate = initial_rate;
|
|
@@ -212,10 +212,10 @@ void Planner::reverse_pass_kernel(block_t* const current, const block_t *next) {
|
212
|
212
|
if (current->entry_speed != max_entry_speed) {
|
213
|
213
|
// If nominal length true, max junction speed is guaranteed to be reached. Only compute
|
214
|
214
|
// for max allowable speed if block is decelerating and nominal length is false.
|
215
|
|
- current->entry_speed = ((current->flag & BLOCK_FLAG_NOMINAL_LENGTH) || max_entry_speed <= next->entry_speed)
|
|
215
|
+ current->entry_speed = (TEST(current->flag, BLOCK_BIT_NOMINAL_LENGTH) || max_entry_speed <= next->entry_speed)
|
216
|
216
|
? max_entry_speed
|
217
|
217
|
: min(max_entry_speed, max_allowable_speed(-current->acceleration, next->entry_speed, current->millimeters));
|
218
|
|
- current->flag |= BLOCK_FLAG_RECALCULATE;
|
|
218
|
+ SBI(current->flag, BLOCK_BIT_RECALCULATE);
|
219
|
219
|
}
|
220
|
220
|
}
|
221
|
221
|
|
|
@@ -237,7 +237,7 @@ void Planner::reverse_pass() {
|
237
|
237
|
|
238
|
238
|
uint8_t b = BLOCK_MOD(block_buffer_head - 3);
|
239
|
239
|
while (b != tail) {
|
240
|
|
- if (block[0] && (block[0]->flag & BLOCK_FLAG_START_FROM_FULL_HALT)) break;
|
|
240
|
+ if (block[0] && TEST(block[0]->flag, BLOCK_BIT_START_FROM_FULL_HALT)) break;
|
241
|
241
|
b = prev_block_index(b);
|
242
|
242
|
block[2] = block[1];
|
243
|
243
|
block[1] = block[0];
|
|
@@ -255,14 +255,14 @@ void Planner::forward_pass_kernel(const block_t* previous, block_t* const curren
|
255
|
255
|
// full speed change within the block, we need to adjust the entry speed accordingly. Entry
|
256
|
256
|
// speeds have already been reset, maximized, and reverse planned by reverse planner.
|
257
|
257
|
// If nominal length is true, max junction speed is guaranteed to be reached. No need to recheck.
|
258
|
|
- if (!(previous->flag & BLOCK_FLAG_NOMINAL_LENGTH)) {
|
|
258
|
+ if (!TEST(previous->flag, BLOCK_BIT_NOMINAL_LENGTH)) {
|
259
|
259
|
if (previous->entry_speed < current->entry_speed) {
|
260
|
260
|
float entry_speed = min(current->entry_speed,
|
261
|
261
|
max_allowable_speed(-previous->acceleration, previous->entry_speed, previous->millimeters));
|
262
|
262
|
// Check for junction speed change
|
263
|
263
|
if (current->entry_speed != entry_speed) {
|
264
|
264
|
current->entry_speed = entry_speed;
|
265
|
|
- current->flag |= BLOCK_FLAG_RECALCULATE;
|
|
265
|
+ SBI(current->flag, BLOCK_BIT_RECALCULATE);
|
266
|
266
|
}
|
267
|
267
|
}
|
268
|
268
|
}
|
|
@@ -298,11 +298,11 @@ void Planner::recalculate_trapezoids() {
|
298
|
298
|
next = &block_buffer[block_index];
|
299
|
299
|
if (current) {
|
300
|
300
|
// Recalculate if current block entry or exit junction speed has changed.
|
301
|
|
- if ((current->flag & BLOCK_FLAG_RECALCULATE) || (next->flag & BLOCK_FLAG_RECALCULATE)) {
|
|
301
|
+ if (TEST(current->flag, BLOCK_BIT_RECALCULATE) || TEST(next->flag, BLOCK_BIT_RECALCULATE)) {
|
302
|
302
|
// NOTE: Entry and exit factors always > 0 by all previous logic operations.
|
303
|
303
|
float nom = current->nominal_speed;
|
304
|
304
|
calculate_trapezoid_for_block(current, current->entry_speed / nom, next->entry_speed / nom);
|
305
|
|
- current->flag &= ~BLOCK_FLAG_RECALCULATE; // Reset current only to ensure next trapezoid is computed
|
|
305
|
+ CBI(current->flag, BLOCK_BIT_RECALCULATE); // Reset current only to ensure next trapezoid is computed
|
306
|
306
|
}
|
307
|
307
|
}
|
308
|
308
|
block_index = next_block_index(block_index);
|
|
@@ -311,7 +311,7 @@ void Planner::recalculate_trapezoids() {
|
311
|
311
|
if (next) {
|
312
|
312
|
float nom = next->nominal_speed;
|
313
|
313
|
calculate_trapezoid_for_block(next, next->entry_speed / nom, (MINIMUM_PLANNER_SPEED) / nom);
|
314
|
|
- next->flag &= ~BLOCK_FLAG_RECALCULATE;
|
|
314
|
+ CBI(next->flag, BLOCK_BIT_RECALCULATE);
|
315
|
315
|
}
|
316
|
316
|
}
|
317
|
317
|
|
|
@@ -666,8 +666,8 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
666
|
666
|
// Prepare to set up new block
|
667
|
667
|
block_t* block = &block_buffer[block_buffer_head];
|
668
|
668
|
|
669
|
|
- // Mark block as not busy (Not executed by the stepper interrupt)
|
670
|
|
- block->busy = false;
|
|
669
|
+ // Clear all flags, including the "busy" bit
|
|
670
|
+ block->flag = 0;
|
671
|
671
|
|
672
|
672
|
// Number of steps for each axis
|
673
|
673
|
#if ENABLED(COREXY)
|
|
@@ -699,9 +699,6 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
699
|
699
|
// Bail if this is a zero-length block
|
700
|
700
|
if (block->step_event_count < MIN_STEPS_PER_SEGMENT) return;
|
701
|
701
|
|
702
|
|
- // Clear the block flags
|
703
|
|
- block->flag = 0;
|
704
|
|
-
|
705
|
702
|
// For a mixing extruder, get a magnified step_event_count for each
|
706
|
703
|
#if ENABLED(MIXING_EXTRUDER)
|
707
|
704
|
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
|
|
@@ -1187,12 +1184,12 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1187
|
1184
|
if (previous_safe_speed > vmax_junction_threshold && safe_speed > vmax_junction_threshold) {
|
1188
|
1185
|
// Not coasting. The machine will stop and start the movements anyway,
|
1189
|
1186
|
// better to start the segment from start.
|
1190
|
|
- block->flag |= BLOCK_FLAG_START_FROM_FULL_HALT;
|
|
1187
|
+ SBI(block->flag, BLOCK_BIT_START_FROM_FULL_HALT);
|
1191
|
1188
|
vmax_junction = safe_speed;
|
1192
|
1189
|
}
|
1193
|
1190
|
}
|
1194
|
1191
|
else {
|
1195
|
|
- block->flag |= BLOCK_FLAG_START_FROM_FULL_HALT;
|
|
1192
|
+ SBI(block->flag, BLOCK_BIT_START_FROM_FULL_HALT);
|
1196
|
1193
|
vmax_junction = safe_speed;
|
1197
|
1194
|
}
|
1198
|
1195
|
|