Merge pull request #3797 from AnHardt/fix-screen-updatedelay

Rework intermediate idle() and manage_heater() calls in G2/G3 and G5
This commit is contained in:
Scott Lahteine 2016-05-19 16:29:27 -07:00
commit 6d68b12e28
4 changed files with 15 additions and 18 deletions

View file

@ -448,11 +448,11 @@
// @section extras // @section extras
// Arc interpretation settings: // Arc interpretation settings:
#define ARC_SUPPORT // Disabling this saves ~2660bytes #define ARC_SUPPORT // Disabling this saves ~2738 bytes
#define MM_PER_ARC_SEGMENT 1 #define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25 #define N_ARC_CORRECTION 25
// Support for G5 with XYZE destination and IJPQ offsets // Support for G5 with XYZE destination and IJPQ offsets. Needs ~2666 bytes
//#define BEZIER_CURVE_SUPPORT //#define BEZIER_CURVE_SUPPORT
const unsigned int dropsegments = 5; //everything with less than this number of steps will be ignored as move and joined with the next movement const unsigned int dropsegments = 5; //everything with less than this number of steps will be ignored as move and joined with the next movement

View file

@ -106,7 +106,7 @@
* G2 - CW ARC * G2 - CW ARC
* G3 - CCW ARC * G3 - CCW ARC
* G4 - Dwell S<seconds> or P<milliseconds> * G4 - Dwell S<seconds> or P<milliseconds>
* G5 - Cubic B-spline with * G5 - Cubic B-spline with XYZE destination and IJPQ offsets
* G10 - retract filament according to settings of M207 * G10 - retract filament according to settings of M207
* G11 - retract recover filament according to settings of M208 * G11 - retract recover filament according to settings of M208
* G28 - Home one or more axes * G28 - Home one or more axes
@ -2546,14 +2546,7 @@ inline void gcode_G4() {
inline void gcode_G5() { inline void gcode_G5() {
if (IsRunning()) { if (IsRunning()) {
#ifdef SF_ARC_FIX
bool relative_mode_backup = relative_mode;
relative_mode = true;
#endif
gcode_get_destination(); gcode_get_destination();
#ifdef SF_ARC_FIX
relative_mode = relative_mode_backup;
#endif
float offset[] = { float offset[] = {
code_seen('I') ? code_value() : 0.0, code_seen('I') ? code_value() : 0.0,
@ -7604,13 +7597,14 @@ void prepare_move() {
float feed_rate = feedrate * feedrate_multiplier / 60 / 100.0; float feed_rate = feedrate * feedrate_multiplier / 60 / 100.0;
millis_t previous_ms = millis(); millis_t next_ping_ms = millis() + 200UL;
for (i = 1; i < segments; i++) { // Iterate (segments-1) times for (i = 1; i < segments; i++) { // Iterate (segments-1) times
thermalManager.manage_heater();
millis_t now = millis(); millis_t now = millis();
if (now - previous_ms > 200UL) { if (ELAPSED(now, next_ping_ms)) {
previous_ms = now; next_ping_ms = now + 200UL;
idle(); idle();
} }

View file

@ -118,15 +118,15 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS]
bez_target[Y_AXIS] = position[Y_AXIS]; bez_target[Y_AXIS] = position[Y_AXIS];
float step = MAX_STEP; float step = MAX_STEP;
uint8_t idle_counter = 0;
millis_t next_ping_ms = millis() + 200UL; millis_t next_ping_ms = millis() + 200UL;
while (t < 1.0) { while (t < 1.0) {
thermalManager.manage_heater();
millis_t now = millis(); millis_t now = millis();
if (ELAPSED(now, next_ping_ms)) { if (ELAPSED(now, next_ping_ms)) {
next_ping_ms = now + 200UL; next_ping_ms = now + 200UL;
(idle_counter++ & 0x03) ? thermalManager.manage_heater() : idle(); idle();
} }
// First try to reduce the step in order to make it sufficiently // First try to reduce the step in order to make it sufficiently

View file

@ -282,7 +282,6 @@ menuPosition menu_history[10];
uint8_t menu_history_depth = 0; uint8_t menu_history_depth = 0;
millis_t next_lcd_update_ms; millis_t next_lcd_update_ms;
uint8_t lcd_status_update_delay;
bool ignore_click = false; bool ignore_click = false;
bool wait_for_unclick; bool wait_for_unclick;
bool defer_return_to_status = false; bool defer_return_to_status = false;
@ -2248,9 +2247,13 @@ void lcd_update() {
} }
#endif //ULTIPANEL #endif //ULTIPANEL
// Simply redraw the Info Screen 10 times a second // Here we arrive every ~100ms when ideling often enough.
if (currentMenu == lcd_status_screen && !(++lcd_status_update_delay % 10)) // 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 (currentMenu == lcd_status_screen && !lcd_status_update_delay--) {
lcd_status_update_delay = 9;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
if (lcdDrawUpdate) { if (lcdDrawUpdate) {