瀏覽代碼

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
 // @section extras
448
 // @section extras
449
 
449
 
450
 // Arc interpretation settings:
450
 // Arc interpretation settings:
451
-#define ARC_SUPPORT  // Disabling this saves ~2660bytes
451
+#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
452
 #define MM_PER_ARC_SEGMENT 1
452
 #define MM_PER_ARC_SEGMENT 1
453
 #define N_ARC_CORRECTION 25
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
 //#define BEZIER_CURVE_SUPPORT
456
 //#define BEZIER_CURVE_SUPPORT
457
 
457
 
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
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
  * G2  - CW ARC
106
  * G2  - CW ARC
107
  * G3  - CCW ARC
107
  * G3  - CCW ARC
108
  * G4  - Dwell S<seconds> or P<milliseconds>
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
  * G10 - retract filament according to settings of M207
110
  * G10 - retract filament according to settings of M207
111
  * G11 - retract recover filament according to settings of M208
111
  * G11 - retract recover filament according to settings of M208
112
  * G28 - Home one or more axes
112
  * G28 - Home one or more axes
2546
   inline void gcode_G5() {
2546
   inline void gcode_G5() {
2547
     if (IsRunning()) {
2547
     if (IsRunning()) {
2548
 
2548
 
2549
-      #ifdef SF_ARC_FIX
2550
-        bool relative_mode_backup = relative_mode;
2551
-        relative_mode = true;
2552
-      #endif
2553
       gcode_get_destination();
2549
       gcode_get_destination();
2554
-      #ifdef SF_ARC_FIX
2555
-        relative_mode = relative_mode_backup;
2556
-      #endif
2557
 
2550
 
2558
       float offset[] = {
2551
       float offset[] = {
2559
         code_seen('I') ? code_value() : 0.0,
2552
         code_seen('I') ? code_value() : 0.0,
7604
 
7597
 
7605
     float feed_rate = feedrate * feedrate_multiplier / 60 / 100.0;
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
     for (i = 1; i < segments; i++) { // Iterate (segments-1) times
7602
     for (i = 1; i < segments; i++) { // Iterate (segments-1) times
7610
 
7603
 
7604
+      thermalManager.manage_heater();
7611
       millis_t now = millis();
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
         idle();
7608
         idle();
7615
       }
7609
       }
7616
 
7610
 

+ 2
- 2
Marlin/planner_bezier.cpp 查看文件

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

+ 6
- 3
Marlin/ultralcd.cpp 查看文件

282
 uint8_t menu_history_depth = 0;
282
 uint8_t menu_history_depth = 0;
283
 
283
 
284
 millis_t next_lcd_update_ms;
284
 millis_t next_lcd_update_ms;
285
-uint8_t lcd_status_update_delay;
286
 bool ignore_click = false;
285
 bool ignore_click = false;
287
 bool wait_for_unclick;
286
 bool wait_for_unclick;
288
 bool defer_return_to_status = false;
287
 bool defer_return_to_status = false;
2248
       }
2247
       }
2249
     #endif //ULTIPANEL
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
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2255
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2256
+    }
2254
 
2257
 
2255
     if (lcdDrawUpdate) {
2258
     if (lcdDrawUpdate) {
2256
 
2259
 

Loading…
取消
儲存