Преглед изворни кода

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

Rework intermediate idle() and manage_heater() calls in G2/G3 and G5
Scott Lahteine пре 9 година
родитељ
комит
6d68b12e28
4 измењених фајлова са 15 додато и 18 уклоњено
  1. 2
    2
      Marlin/Configuration_adv.h
  2. 5
    11
      Marlin/Marlin_main.cpp
  3. 2
    2
      Marlin/planner_bezier.cpp
  4. 6
    3
      Marlin/ultralcd.cpp

+ 2
- 2
Marlin/Configuration_adv.h Прегледај датотеку

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

+ 5
- 11
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -106,7 +106,7 @@
106 106
  * G2  - CW ARC
107 107
  * G3  - CCW ARC
108 108
  * G4  - Dwell S<seconds> or P<milliseconds>
109
- * G5  - Cubic B-spline with
109
+ * G5  - Cubic B-spline with XYZE destination and IJPQ offsets
110 110
  * G10 - retract filament according to settings of M207
111 111
  * G11 - retract recover filament according to settings of M208
112 112
  * G28 - Home one or more axes
@@ -2546,14 +2546,7 @@ inline void gcode_G4() {
2546 2546
   inline void gcode_G5() {
2547 2547
     if (IsRunning()) {
2548 2548
 
2549
-      #ifdef SF_ARC_FIX
2550
-        bool relative_mode_backup = relative_mode;
2551
-        relative_mode = true;
2552
-      #endif
2553 2549
       gcode_get_destination();
2554
-      #ifdef SF_ARC_FIX
2555
-        relative_mode = relative_mode_backup;
2556
-      #endif
2557 2550
 
2558 2551
       float offset[] = {
2559 2552
         code_seen('I') ? code_value() : 0.0,
@@ -7604,13 +7597,14 @@ void prepare_move() {
7604 7597
 
7605 7598
     float feed_rate = feedrate * feedrate_multiplier / 60 / 100.0;
7606 7599
 
7607
-    millis_t previous_ms = millis();
7600
+    millis_t next_ping_ms = millis() + 200UL;
7608 7601
 
7609 7602
     for (i = 1; i < segments; i++) { // Iterate (segments-1) times
7610 7603
 
7604
+      thermalManager.manage_heater();
7611 7605
       millis_t now = millis();
7612
-      if (now - previous_ms > 200UL) {
7613
-        previous_ms = now;
7606
+      if (ELAPSED(now, next_ping_ms)) {
7607
+        next_ping_ms = now + 200UL;
7614 7608
         idle();
7615 7609
       }
7616 7610
 

+ 2
- 2
Marlin/planner_bezier.cpp Прегледај датотеку

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

+ 6
- 3
Marlin/ultralcd.cpp Прегледај датотеку

@@ -282,7 +282,6 @@ menuPosition menu_history[10];
282 282
 uint8_t menu_history_depth = 0;
283 283
 
284 284
 millis_t next_lcd_update_ms;
285
-uint8_t lcd_status_update_delay;
286 285
 bool ignore_click = false;
287 286
 bool wait_for_unclick;
288 287
 bool defer_return_to_status = false;
@@ -2248,9 +2247,13 @@ void lcd_update() {
2248 2247
       }
2249 2248
     #endif //ULTIPANEL
2250 2249
 
2251
-    // Simply redraw the Info Screen 10 times a second
2252
-    if (currentMenu == lcd_status_screen && !(++lcd_status_update_delay % 10))
2250
+    // Here we arrive every ~100ms when ideling often enough.
2251
+    // Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
2252
+    static int8_t lcd_status_update_delay = 1; // first update one loop delayed
2253
+    if (currentMenu == lcd_status_screen && !lcd_status_update_delay--) {
2254
+      lcd_status_update_delay = 9;
2253 2255
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2256
+    }
2254 2257
 
2255 2258
     if (lcdDrawUpdate) {
2256 2259
 

Loading…
Откажи
Сачувај