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