|
@@ -210,6 +210,10 @@ class Planner {
|
210
|
210
|
static float extruder_advance_k;
|
211
|
211
|
#endif
|
212
|
212
|
|
|
213
|
+ #if ENABLED(ENSURE_SMOOTH_MOVES)
|
|
214
|
+ static uint32_t block_buffer_runtime_us; //Theoretical block buffer runtime in µs
|
|
215
|
+ #endif
|
|
216
|
+
|
213
|
217
|
public:
|
214
|
218
|
|
215
|
219
|
/**
|
|
@@ -367,6 +371,9 @@ class Planner {
|
367
|
371
|
static block_t* get_current_block() {
|
368
|
372
|
if (blocks_queued()) {
|
369
|
373
|
block_t* block = &block_buffer[block_buffer_tail];
|
|
374
|
+ #if ENABLED(ENSURE_SMOOTH_MOVES)
|
|
375
|
+ block_buffer_runtime_us -= block->segment_time; //We can't be sure how long an active block will take, so don't count it.
|
|
376
|
+ #endif
|
370
|
377
|
SBI(block->flag, BLOCK_BIT_BUSY);
|
371
|
378
|
return block;
|
372
|
379
|
}
|
|
@@ -378,11 +385,15 @@ class Planner {
|
378
|
385
|
static bool long_move() {
|
379
|
386
|
if (blocks_queued()) {
|
380
|
387
|
block_t* block = &block_buffer[block_buffer_tail];
|
381
|
|
- return block->segment_time > (LCD_UPDATE_THRESHOLD) * 1000UL;
|
|
388
|
+ return block_buffer_runtime_us > (LCD_UPDATE_THRESHOLD) * 1000UL + (MIN_BLOCK_TIME) * 3000UL;
|
382
|
389
|
}
|
383
|
390
|
else
|
384
|
391
|
return true;
|
385
|
392
|
}
|
|
393
|
+
|
|
394
|
+ static void clear_block_buffer_runtime(){
|
|
395
|
+ block_buffer_runtime_us = 0;
|
|
396
|
+ }
|
386
|
397
|
#endif
|
387
|
398
|
|
388
|
399
|
#if ENABLED(AUTOTEMP)
|