From de89dc9f04a076c2910c018be9e2ae80b60860a5 Mon Sep 17 00:00:00 2001 From: Sebastianv650 Date: Fri, 11 Nov 2016 18:15:39 +0100 Subject: [PATCH 1/3] Ensure smooth print moves even with LCD enabled lcd_update can take so much time that the block buffer gets drained if there are only short segments. This leads to jerky printer movements for example in circles and a bad print quality. This change implements a simple check: Only if the block currently executed is long enough, run lcd_update. This also means the printer will not show actual values on the LCD nor will it respond to buttons pressed. A option that keeps the menu accessible is also available. Aditionaly, slow down if a block would be so fast that adding a new block to the buffer would take more time. In this case, the buffer would drain until it's empty in worst case. --- Marlin/Configuration_adv.h | 20 ++++++++++++++++++++ Marlin/planner.cpp | 14 +++++++++++++- Marlin/planner.h | 15 +++++++++++++++ Marlin/ultralcd.cpp | 28 ++++++++++++++++++++-------- 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index f750c42fa..a3cb9f0ea 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -496,6 +496,26 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// Enabling ENSURE_SMOOTH_MOVES ensures your printer will never stutter (for example in circles with a short segments). That's done in two steps: +// --1-- +// During short segments like in circles, the update of the LCD Display can take so long that the block buffer gets completely drained. +// If that happens, the movement of the printer gets very jerky until a longer segment like a longer straight line allows the buffer +// to be filled again. This small stops also effects print quality in a bad way. +// Enable ENSURE_SMOOTH_MOVES to update the LCD only when there is enough time during a move to do so. +// Note that this means the display will not show actual values during this time and your printer will also not react to buttons +// pressed immediately, except ALWAYS_ALLOW_MENU is also enabled. +// --2-- +// No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main loop to add a new block to the buffer, checking temps, +// including all interruptions due to interrupts, but without LCD update. If we would allow shorter moves, the buffer would start continously draining. +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will be always accessible. + // WARNING: If the menu is entered or navigated during short moves, the printer will stutter like without ENSURE_SMOOTH_MOVES! + #define LCD_UPDATE_THRESHOLD 170 // Minimum duration in ms of the current segment to allow a LCD update. + // Default value is valid for graphical LCDs like the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER. + #define MIN_BLOCK_TIME 6 // Minimum duration in ms a single block has to take. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index ab03d9fe3..c9d681e9b 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -937,12 +937,24 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const if (segment_time < min_segment_time) { // buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more. inverse_mm_s = 1000000.0 / (segment_time + lround(2 * (min_segment_time - segment_time) / moves_queued)); - #ifdef XY_FREQUENCY_LIMIT + #if defined(XY_FREQUENCY_LIMIT) || ENABLED(ENSURE_SMOOTH_MOVES) segment_time = lround(1000000.0 / inverse_mm_s); #endif } } #endif + + #if ENABLED(ENSURE_SMOOTH_MOVES) + #if DISABLED(SLOWDOWN) + unsigned long segment_time = lround(1000000.0 / inverse_mm_s); + #endif + if (segment_time < (MIN_BLOCK_TIME) * 1000UL) { + // buffer will be draining, set to MIN_BLOCK_TIME. + inverse_mm_s = 1000000.0 / (1000.0 * (MIN_BLOCK_TIME)); + segment_time = (MIN_BLOCK_TIME) * 1000UL; + } + block->segment_time = segment_time; + #endif block->nominal_speed = block->millimeters * inverse_mm_s; // (mm/sec) Always > 0 block->nominal_rate = ceil(block->step_event_count * inverse_mm_s); // (step/sec) Always > 0 diff --git a/Marlin/planner.h b/Marlin/planner.h index 8b8d49865..8ec45f76a 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -123,6 +123,10 @@ typedef struct { #if ENABLED(BARICUDA) uint32_t valve_pressure, e_to_p_pressure; #endif + + #if ENABLED(ENSURE_SMOOTH_MOVES) + uint32_t segment_time; + #endif } block_t; @@ -366,6 +370,17 @@ class Planner { return NULL; } + #if ENABLED(ENSURE_SMOOTH_MOVES) + static bool long_move() { + if (blocks_queued()) { + block_t* block = &block_buffer[block_buffer_tail]; + return (block->segment_time > (LCD_UPDATE_THRESHOLD * 1000UL)); + } + else + return true; + } + #endif + #if ENABLED(AUTOTEMP) static float autotemp_max; static float autotemp_min; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 2216a9f1c..cd56f6079 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2710,15 +2710,24 @@ void lcd_update() { // We arrive here every ~100ms when idling often enough. // Instead of tracking the changes simply redraw the Info Screen ~1 time a second. static int8_t lcd_status_update_delay = 1; // first update one loop delayed - if ( - #if ENABLED(ULTIPANEL) - currentScreen == lcd_status_screen && - #endif - !lcd_status_update_delay--) { - lcd_status_update_delay = 9; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - } + #if ENABLED(ENSURE_SMOOTH_MOVES) && ENABLED(ALWAYS_ALLOW_MENU) + if (planner.long_move()) { + #endif + if ( + #if ENABLED(ULTIPANEL) + currentScreen == lcd_status_screen && + #endif + !lcd_status_update_delay--) { + lcd_status_update_delay = 9; + lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + } + #if ENABLED(ENSURE_SMOOTH_MOVES) && ENABLED(ALWAYS_ALLOW_MENU) + } + #endif + #if ENABLED(ENSURE_SMOOTH_MOVES) && DISABLED(ALWAYS_ALLOW_MENU) + if (planner.long_move()) { + #endif if (lcdDrawUpdate) { switch (lcdDrawUpdate) { @@ -2779,6 +2788,9 @@ void lcd_update() { break; } + #if ENABLED(ENSURE_SMOOTH_MOVES) && DISABLED(ALWAYS_ALLOW_MENU) + } + #endif } } From 072541f28651f89dad1e0d511ff425e2dea45066 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 19 Nov 2016 01:08:37 -0600 Subject: [PATCH 2/3] Update ENSURE_SMOOTH_MOVES in all configs --- Marlin/Configuration_adv.h | 41 +++++++++++-------- .../Cartesio/Configuration_adv.h | 29 +++++++++++++ .../Felix/Configuration_adv.h | 29 +++++++++++++ .../Hephestos/Configuration_adv.h | 29 +++++++++++++ .../Hephestos_2/Configuration_adv.h | 29 +++++++++++++ .../K8200/Configuration_adv.h | 29 +++++++++++++ .../K8400/Configuration_adv.h | 29 +++++++++++++ .../RigidBot/Configuration_adv.h | 29 +++++++++++++ .../SCARA/Configuration_adv.h | 29 +++++++++++++ .../TAZ4/Configuration_adv.h | 29 +++++++++++++ .../WITBOX/Configuration_adv.h | 29 +++++++++++++ .../delta/biv2.5/Configuration_adv.h | 29 +++++++++++++ .../delta/generic/Configuration_adv.h | 29 +++++++++++++ .../delta/kossel_mini/Configuration_adv.h | 29 +++++++++++++ .../delta/kossel_pro/Configuration_adv.h | 29 +++++++++++++ .../delta/kossel_xl/Configuration_adv.h | 29 +++++++++++++ .../makibox/Configuration_adv.h | 29 +++++++++++++ .../tvrrug/Round2/Configuration_adv.h | 29 +++++++++++++ 18 files changed, 518 insertions(+), 16 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a3cb9f0ea..9850d5570 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -496,24 +496,33 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif -// Enabling ENSURE_SMOOTH_MOVES ensures your printer will never stutter (for example in circles with a short segments). That's done in two steps: -// --1-- -// During short segments like in circles, the update of the LCD Display can take so long that the block buffer gets completely drained. -// If that happens, the movement of the printer gets very jerky until a longer segment like a longer straight line allows the buffer -// to be filled again. This small stops also effects print quality in a bad way. -// Enable ENSURE_SMOOTH_MOVES to update the LCD only when there is enough time during a move to do so. -// Note that this means the display will not show actual values during this time and your printer will also not react to buttons -// pressed immediately, except ALWAYS_ALLOW_MENU is also enabled. -// --2-- -// No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main loop to add a new block to the buffer, checking temps, -// including all interruptions due to interrupts, but without LCD update. If we would allow shorter moves, the buffer would start continously draining. +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// //#define ENSURE_SMOOTH_MOVES #if ENABLED(ENSURE_SMOOTH_MOVES) - //#define ALWAYS_ALLOW_MENU // If enabled, the menu will be always accessible. - // WARNING: If the menu is entered or navigated during short moves, the printer will stutter like without ENSURE_SMOOTH_MOVES! - #define LCD_UPDATE_THRESHOLD 170 // Minimum duration in ms of the current segment to allow a LCD update. - // Default value is valid for graphical LCDs like the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER. - #define MIN_BLOCK_TIME 6 // Minimum duration in ms a single block has to take. You shouldn't need to modify this. + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. #endif // @section extruder diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 886cdd38f..463254c04 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 70d4d434e..80c52620b 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index a749bcde0..17c200ba3 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index cddfc6ede..5f54de89e 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 5ff3899fc..4d4335bb3 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -509,6 +509,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index d785efb7a..d2f3aea8b 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 6a2e56f3a..2b45809ff 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 3aac74fe1..e2b39c89c 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 176c73edf..c8067fd6d 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -504,6 +504,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index a749bcde0..17c200ba3 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index f0370b5d7..630b10060 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -498,6 +498,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index d897d4662..703c42f26 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -498,6 +498,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index d897d4662..703c42f26 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -498,6 +498,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 8805a3b4c..0ccc9cf4b 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -503,6 +503,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index ea4118977..35e119b49 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -498,6 +498,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 9a5213329..150ed0f7d 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 0d1575c08..373a73d98 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -496,6 +496,35 @@ #define BABYSTEP_MULTIPLICATOR 1 //faster movements #endif +// +// Ensure Smooth Moves +// +// Enable this option to prevent the machine from stuttering when printing multiple short segments. +// This feature uses two strategies to eliminate stuttering: +// +// 1. During short segments a Graphical LCD update may take so much time that the planner buffer gets +// completely drained. When this happens pauses are introduced between short segments, and print moves +// will become jerky until a longer segment provides enough time for the buffer to be filled again. +// This jerkiness negatively affects print quality. The ENSURE_SMOOTH_MOVES option addresses the issue +// by pausing the LCD until there's enough time to safely update. +// +// NOTE: This will cause the Info Screen to lag and controller buttons may become unresponsive. +// Enable ALWAYS_ALLOW_MENU to keep the controller responsive. +// +// 2. No block is allowed to take less time than MIN_BLOCK_TIME. That's the time it takes in the main +// loop to add a new block to the buffer, check temperatures, etc., including all blocked time due to +// interrupts (without LCD update). By enforcing a minimum time-per-move, the buffer is prevented from +// draining. +// +//#define ENSURE_SMOOTH_MOVES +#if ENABLED(ENSURE_SMOOTH_MOVES) + //#define ALWAYS_ALLOW_MENU // If enabled, the menu will always be responsive. + // WARNING: Menu navigation during short moves may cause stuttering! + #define LCD_UPDATE_THRESHOLD 170 // (ms) Minimum duration for the current segment to allow an LCD update. + // Default value is good for graphical LCDs (e.g., REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER). + #define MIN_BLOCK_TIME 6 // (ms) Minimum duration of a single block. You shouldn't need to modify this. +#endif + // @section extruder // extruder advance constant (s2/mm3) From 2cc32d85a3917c56d5fa7a02ceb809aa50de844b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 19 Nov 2016 01:09:32 -0600 Subject: [PATCH 3/3] Adjust ENSURE_SMOOTH_MOVES coding style --- Marlin/planner.h | 2 +- Marlin/ultralcd.cpp | 146 +++++++++++++++++++++++--------------------- 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/Marlin/planner.h b/Marlin/planner.h index 8ec45f76a..3121f1943 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -374,7 +374,7 @@ class Planner { static bool long_move() { if (blocks_queued()) { block_t* block = &block_buffer[block_buffer_tail]; - return (block->segment_time > (LCD_UPDATE_THRESHOLD * 1000UL)); + return block->segment_time > (LCD_UPDATE_THRESHOLD) * 1000UL; } else return true; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index cd56f6079..7073b9125 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2707,90 +2707,94 @@ void lcd_update() { } #endif // ULTIPANEL + #if ENABLED(ENSURE_SMOOTH_MOVES) && ENABLED(ALWAYS_ALLOW_MENU) + #define STATUS_UPDATE_CONDITION planner.long_move() + #else + #define STATUS_UPDATE_CONDITION true + #endif + #if ENABLED(ENSURE_SMOOTH_MOVES) && DISABLED(ALWAYS_ALLOW_MENU) + #define LCD_HANDLER_CONDITION planner.long_move() + #else + #define LCD_HANDLER_CONDITION true + #endif + // We arrive here every ~100ms when idling often enough. // Instead of tracking the changes simply redraw the Info Screen ~1 time a second. static int8_t lcd_status_update_delay = 1; // first update one loop delayed - #if ENABLED(ENSURE_SMOOTH_MOVES) && ENABLED(ALWAYS_ALLOW_MENU) - if (planner.long_move()) { - #endif - if ( - #if ENABLED(ULTIPANEL) - currentScreen == lcd_status_screen && - #endif - !lcd_status_update_delay--) { - lcd_status_update_delay = 9; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - } - #if ENABLED(ENSURE_SMOOTH_MOVES) && ENABLED(ALWAYS_ALLOW_MENU) - } - #endif + if (STATUS_UPDATE_CONDITION && + #if ENABLED(ULTIPANEL) + currentScreen == lcd_status_screen && + #endif + !lcd_status_update_delay-- + ) { + lcd_status_update_delay = 9; + lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + } - #if ENABLED(ENSURE_SMOOTH_MOVES) && DISABLED(ALWAYS_ALLOW_MENU) - if (planner.long_move()) { - #endif - if (lcdDrawUpdate) { + if (LCD_HANDLER_CONDITION) { - switch (lcdDrawUpdate) { - case LCDVIEW_CALL_NO_REDRAW: - lcdDrawUpdate = LCDVIEW_NONE; - break; - case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here) - case LCDVIEW_CALL_REDRAW_NEXT: // set by handlers, then altered after (never occurs here?) - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - case LCDVIEW_REDRAW_NOW: // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT - case LCDVIEW_NONE: - break; + if (lcdDrawUpdate) { + + switch (lcdDrawUpdate) { + case LCDVIEW_CALL_NO_REDRAW: + lcdDrawUpdate = LCDVIEW_NONE; + break; + case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here) + case LCDVIEW_CALL_REDRAW_NEXT: // set by handlers, then altered after (never occurs here?) + lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + case LCDVIEW_REDRAW_NOW: // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT + case LCDVIEW_NONE: + break; + } // switch + + #if ENABLED(ULTIPANEL) + #define CURRENTSCREEN() (*currentScreen)(), lcd_clicked = false + #else + #define CURRENTSCREEN() lcd_status_screen() + #endif + + #if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display + static int8_t dot_color = 0; + dot_color = 1 - dot_color; + u8g.firstPage(); + do { + lcd_setFont(FONT_MENU); + u8g.setPrintPos(125, 0); + u8g.setColorIndex(dot_color); // Set color for the alive dot + u8g.drawPixel(127, 63); // draw alive dot + u8g.setColorIndex(1); // black on white + CURRENTSCREEN(); + } while (u8g.nextPage()); + #else + CURRENTSCREEN(); + #endif } #if ENABLED(ULTIPANEL) - #define CURRENTSCREEN() (*currentScreen)(), lcd_clicked = false - #else - #define CURRENTSCREEN() lcd_status_screen() - #endif - #if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display - static int8_t dot_color = 0; - dot_color = 1 - dot_color; - u8g.firstPage(); - do { - lcd_setFont(FONT_MENU); - u8g.setPrintPos(125, 0); - u8g.setColorIndex(dot_color); // Set color for the alive dot - u8g.drawPixel(127, 63); // draw alive dot - u8g.setColorIndex(1); // black on white - CURRENTSCREEN(); - } while (u8g.nextPage()); - #else - CURRENTSCREEN(); - #endif - } + // Return to Status Screen after a timeout + if (currentScreen == lcd_status_screen || defer_return_to_status) + return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + else if (ELAPSED(ms, return_to_status_ms)) + lcd_return_to_status(); - #if ENABLED(ULTIPANEL) + #endif // ULTIPANEL - // Return to Status Screen after a timeout - if (currentScreen == lcd_status_screen || defer_return_to_status) - return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; - else if (ELAPSED(ms, return_to_status_ms)) - lcd_return_to_status(); + switch (lcdDrawUpdate) { + case LCDVIEW_CLEAR_CALL_REDRAW: + lcd_implementation_clear(); + case LCDVIEW_CALL_REDRAW_NEXT: + lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + break; + case LCDVIEW_REDRAW_NOW: + lcdDrawUpdate = LCDVIEW_NONE; + break; + case LCDVIEW_NONE: + break; + } // switch - #endif // ULTIPANEL + } // LCD_HANDLER_CONDITION - switch (lcdDrawUpdate) { - case LCDVIEW_CLEAR_CALL_REDRAW: - lcd_implementation_clear(); - case LCDVIEW_CALL_REDRAW_NEXT: - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - break; - case LCDVIEW_REDRAW_NOW: - lcdDrawUpdate = LCDVIEW_NONE; - break; - case LCDVIEW_NONE: - break; - } - - #if ENABLED(ENSURE_SMOOTH_MOVES) && DISABLED(ALWAYS_ALLOW_MENU) - } - #endif } }